Style Class
Represents display style of excel document,such as font,color,alignment,border,etc.
Inheritance Hierarchy
SystemObject
  Aspose.CellsStyle

Namespace: Aspose.Cells
Assembly: Aspose.Cells (in Aspose.Cells.dll) Version: 19.11.0.0 (19.11)
Syntax
[SerializableAttribute]
public class Style

The Style type exposes the following members.

Constructors
  NameDescription
Public methodStyle Obsolete.
Initializes a new instance of the Style class.
Properties
  NameDescription
Public propertyBackgroundArgbColor
Gets and sets the background color with a 32-bit ARGB value.
Public propertyBackgroundColor
Gets or sets a style's background color.
Public propertyBackgroundThemeColor
Gets and sets the background theme color.
Public propertyBorders
Gets the BorderCollection of the style.
Public propertyCultureCustom
Gets and sets the culture-dependent pattern string for number format. If no number format has been set for this object, null will be returned. If number format is builtin, the pattern string corresponding to the builtin number will be returned.
Public propertyCustom
Represents the Custom number format string of a cell. If the Custom number format is not set(For example, the number format is builtin), we will return "".
Public propertyFont
Gets a Font object.
Public propertyForegroundArgbColor
Gets and sets the foreground color with a 32-bit ARGB value.
Public propertyForegroundColor
Gets or sets a style's foreground color.
Public propertyForegroundThemeColor
Gets and sets the foreground theme color.
Public propertyHorizontalAlignment
Gets or sets the horizontal alignment type of the text in a cell.
Public propertyIndentLevel
Represents the m_IndentLevel level for the cell or range. Can only be an integer from 0 to 250.
Public propertyInvariantCustom
Gets the culture-independent pattern string for number format. If no number format has been set for this object, null will be returned. If number format is builtin, the pattern string corresponding to the builtin number will be returned.
Public propertyIsDateTime
Indicates whether the number format is a date format.
Public propertyIsFormulaHidden
Represents if the formula will be hidden when the worksheet is protected.
Public propertyIsGradient
Indicates whether the cell shading is a gradient pattern.
Public propertyIsJustifyDistributed
Indicates if the cells justified or distributed alignment should be used on the last line of text.
Public propertyIsLocked
Gets or sets a value indicating whether a cell can be modified or not.
Public propertyIsPercent
Indicates whether the number format is a percent format.
Public propertyIsTextWrapped
Gets or sets a value indicating whether the text within a cell is wrapped.
Public propertyName
Gets or sets the name of the style.
Public propertyNumber
Gets or sets the display format of numbers and dates. The formatting patterns are different for different regions.
Public propertyParentStyle
Gets the parent style of this style.
Public propertyPattern
Gets or sets the cell background pattern type.
Public propertyQuotePrefix
Indicates whether the cell's value starts with single quote mark.
Public propertyRotation Obsolete.
Represents text rotation angle.
Public propertyRotationAngle
Represents text rotation angle.
Public propertyShrinkToFit
Represents if text automatically shrinks to fit in the available column width.
Public propertyTextDirection
Represents text reading order.
Public propertyVerticalAlignment
Gets or sets the vertical alignment type of the text in a cell.
Methods
  NameDescription
Public methodCopy
Copies data from another style object
Public methodEquals
Determines whether two Style instances are equal.
(Overrides ObjectEquals(Object).)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as a hash function for a Style object.
(Overrides ObjectGetHashCode.)
Public methodGetTwoColorGradient
Get the two-color gradient setting.
Public methodGetType
Gets the type of the current instance.
(Inherited from Object.)
Public methodIsModified
Checks whether the specified properties of the style have been modified. Used for style of ConditionalFormattings to check whether the specified properties of this style should be used when applying the ConditionalFormattings on a cell.
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodSetBorder
Sets the border of the style.
Public methodSetCustom
Sets the Custom number format string of a cell.
Public methodSetPatternColor
Sets the background color.
Public methodSetTwoColorGradient
Sets the specified fill to a two-color gradient.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Public methodUpdate
Apply the named style to the styles of the cells which use this named style. It works like clicking the "ok" button after you finished modifying the style. Only applies for named style.
Examples
[C#]
Cell cell = excel.Worksheets[0].Cells["A1"];
Style style =  cell.GetStyle();
style.Font.Name = "Times New Roman";
style.Font.Color = Color.Blue;
cell.SetStyle(style);
See Also