Class MsoFormatPicture

MsoFormatPicture class

Represents the picture format.

public class MsoFormatPicture

Properties

NameDescription
BottomCrop { get; set; }Represents the location of the bottom of the crop rectangle expressed, expressed as a ratio of the image’s height.
BottomCropInch { get; set; }Represents the location of the bottom of the crop rectangle expressed, in unit of inches.
Brightness { get; set; }Represents the brightness modification for the picture in unit of percentage.
Contrast { get; set; }Represents the contrast modification for the picture.in unit of percentage.
Gamma { get; set; }Represents gamma of the picture.
IsBiLevel { get; set; }Indicates whether this picture should display in two-color black and white.
IsGray { get; set; }Indicates whether this picture should display in grayscale.
LeftCrop { get; set; }Represents the location of the left of the crop rectangle expressed, expressed as a ratio of the image’s width.
LeftCropInch { get; set; }Represents the location of the left of the crop rectangle expressed, in unit of inches.
RightCrop { get; set; }Represents the location of the right of the crop rectangle expressed, expressed as a ratio of the image’s width.
RightCropInch { get; set; }Represents the location of the right of the crop rectangle expressed, in unit of inches.
TopCrop { get; set; }Represents the location of the top of the crop rectangle expressed, expressed as a ratio of the image’s height.
TopCropInch { get; set; }Represents the location of the top of the crop rectangle expressed, in unit of inches.
Transparency { get; set; }Returns or sets the degree of transparency of the area as a value from 0.0 (opaque) through 1.0 (clear).
TransparentColor { get; set; }Gets and sets the transparent color of the picture.

Methods

NameDescription
override Equals(object)
override GetHashCode()Gets the hash code.

Examples

[C#]

using Aspose.Cells;
using Aspose.Cells.Drawing;
using System;
using System.Drawing;

namespace Demos
{
    public class MsoFormatPictureDemo
    {
        public static void RunDemo()
        {
            // Create a new workbook
            Workbook workbook = new Workbook();
            Worksheet sheet = workbook.Worksheets[0];

            // Add a picture to the worksheet
            int pictureIndex = sheet.Pictures.Add(5, 5, "MsoFormatPictureDemo.jpg");
            Picture picture = sheet.Pictures[pictureIndex];

            // Access the MsoFormatPicture object
            MsoFormatPicture formatPicture = picture.FormatPicture;

            // Set properties of MsoFormatPicture
            formatPicture.TopCropInch = 0.5;
            formatPicture.BottomCropInch = 0.5;
            formatPicture.LeftCropInch = 0.5;
            formatPicture.RightCropInch = 0.5;
            formatPicture.Transparency = 0.5;
            formatPicture.Contrast = 0.8;
            formatPicture.Brightness = 0.6;
            formatPicture.Gamma = 1.0;
            formatPicture.IsBiLevel = false;
            formatPicture.IsGray = false;

            // Set the transparent color
            CellsColor transparentColor = workbook.CreateCellsColor();
            transparentColor.Color = Color.White;
            formatPicture.TransparentColor = transparentColor;

            // Save the workbook
            workbook.Save("MsoFormatPictureDemo.xlsx");
        }
    }
}

See Also