Class StyleFlag

StyleFlag class

Represents flags which indicates applied formatting properties.

public class StyleFlag

Constructors

NameDescription
StyleFlag()Constructs an object with all flags as false.

Properties

NameDescription
Alignments { get; set; }Alignment setting will be applied.
All { get; set; }All properties will be applied.
Borders { get; set; }All borders settings will be applied.
BottomBorder { get; set; }Bottom border settings will be applied.
CellShading { get; set; }Cell shading setting will be applied.
DiagonalDownBorder { get; set; }Diagonal down border settings will be applied.
DiagonalUpBorder { get; set; }Diagonal up border settings will be applied.
Font { get; set; }Font settings will be applied.
FontBold { get; set; }Font bold setting will be applied.
FontColor { get; set; }Font color setting will be applied.
FontItalic { get; set; }Font italic setting will be applied.
FontName { get; set; }Font name setting will be applied.
FontScript { get; set; }Font script setting will be applied.
FontSize { get; set; }Font size setting will be applied.
FontStrike { get; set; }Font strikeout setting will be applied.
FontUnderline { get; set; }Font underline setting will be applied.
HideFormula { get; set; }Hide formula setting will be applied.
HorizontalAlignment { get; set; }Horizontal alignment setting will be applied.
Indent { get; set; }Indent level setting will be applied.
LeftBorder { get; set; }Left border settings will be applied.
Locked { get; set; }Locked setting will be applied.
NumberFormat { get; set; }Number format setting will be applied.
QuotePrefix { get; set; }Hide formula setting will be applied.
RightBorder { get; set; }Right border settings will be applied.
Rotation { get; set; }Rotation setting will be applied.
ShrinkToFit { get; set; }Shrink to fit setting will be applied.
TextDirection { get; set; }Text direction setting will be applied.
TopBorder { get; set; }Top border settings will be applied.
VerticalAlignment { get; set; }Vertical alignment setting will be applied.
WrapText { get; set; }Wrap text setting will be applied.

Examples

[C#]

namespace Demos
{
    using Aspose.Cells;
    using System;

    public class StyleFlagDemo
    {
        public static void StyleFlagExample()
        {
            // Create a new workbook and get the first worksheet
            Workbook workbook = new Workbook();
            Worksheet worksheet = workbook.Worksheets[0];

            // Add some sample data to the worksheet
            worksheet.Cells["A1"].PutValue("Header 1");
            worksheet.Cells["B1"].PutValue("Header 2");
            worksheet.Cells["A2"].PutValue(10);
            worksheet.Cells["B2"].PutValue(20);
            worksheet.Cells["A3"].PutValue(30);
            worksheet.Cells["B3"].PutValue(40);

            // Create a new style object
            Style style = workbook.CreateStyle();
            style.Font.Name = "Arial";
            style.Font.Size = 12;
            style.Font.IsBold = true;
            style.ForegroundColor = System.Drawing.Color.Yellow;
            style.Pattern = BackgroundType.Solid;

            // Create a new StyleFlag object
            StyleFlag styleFlag = new StyleFlag
            {
                All = true,
                Font = true,
                FontSize = true,
                FontBold = true,
                CellShading = true
            };

            // Apply the style to a range of cells
            Aspose.Cells.Range range = worksheet.Cells.CreateRange("A1:B1");
            range.ApplyStyle(style, styleFlag);

            // Save the workbook
            workbook.Save("StyleFlagExample.xlsx");

            return;
        }
    }
}

See Also