Aspose::Cells::Style class
Contents
[
Hide
]Style class
Represents display style of excel document,such as font,color,alignment,border,etc. The Style object contains all style attributes (font, number format, alignment, and so on) as properties.
class Style
Methods
Method | Description |
---|---|
Copy(const Style& style) | Copies data from another style object. |
Equals(const Aspose::Cells::Object& obj) | Determines whether two Style instances are equal. |
GetBackgroundArgbColor() | Gets and sets the background color with a 32-bit ARGB value. |
GetBackgroundColor() | Gets or sets a style’s background color. |
GetBackgroundThemeColor() | Gets and sets the background theme color. |
GetBorders() | Gets the BorderCollection of the style. |
GetCultureCustom() | 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. |
GetCustom() | Represents the custom number format string of this style object. If the custom number format is not set(For example, the number format is builtin), "" will be returned. |
GetFont() | Gets a Font object. |
GetForegroundArgbColor() | Gets and sets the foreground color with a 32-bit ARGB value. |
GetForegroundColor() | Gets or sets a style’s foreground color. |
GetForegroundThemeColor() | Gets and sets the foreground theme color. |
GetHasBorders() | Checks whether there are borders have been set for the style. |
GetHashCode() | Serves as a hash function for a Style object. |
GetHorizontalAlignment() | Gets or sets the horizontal alignment type of the text in a cell. |
GetIndentLevel() | Represents the indent level for the cell or range. Can only be an integer from 0 to 250. |
GetInvariantCustom() | 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. |
GetName() | Gets or sets the name of the style. |
GetNumber() | Gets or sets the display format of numbers and dates. The formatting patterns are different for different regions. |
GetParentStyle() | Gets the parent style of this style. |
GetPattern() | Gets or sets the cell background pattern type. |
GetQuotePrefix() | Indicates whether the cell’s value starts with single quote mark. |
GetRotationAngle() | Represents text rotation angle. |
GetShrinkToFit() | Represents if text automatically shrinks to fit in the available column width. |
GetTextDirection() | Represents text reading order. |
GetTwoColorGradientSetting() | Get the two-color gradient setting. |
GetVerticalAlignment() | Gets or sets the vertical alignment type of the text in a cell. |
IsAlignmentApplied() | Indicate whether the alignment formatting should be applied. |
IsBorderApplied() | Indicate whether the border formatting should be applied. |
IsDateTime() | Indicates whether the number format is a date format. |
IsFillApplied() | Indicate whether the fill formatting should be applied. |
IsFontApplied() | Indicate whether the font formatting should be applied. |
IsFormulaHidden() | Represents if the formula will be hidden when the worksheet is protected. |
IsGradient() | Indicates whether the cell shading is a gradient pattern. |
IsJustifyDistributed() | Indicates if the cells justified or distributed alignment should be used on the last line of text. |
IsLocked() | Gets or sets a value indicating whether a cell can be modified or not. |
IsModified(StyleModifyFlag modifyFlag) | 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. |
IsNull() const | Checks whether the implementation object is nullptr. |
IsNumberFormatApplied() | Indicate whether the number formatting should be applied. |
IsPercent() | Indicates whether the number format is a percent format. |
IsProtectionApplied() | Indicate whether the protection formatting should be applied. |
IsTextWrapped() | Gets or sets a value indicating whether the text within a cell is wrapped. |
explicit operator bool() const | operator bool() |
operator=(const Style& src) | operator= |
SetBackgroundArgbColor(int32_t value) | Gets and sets the background color with a 32-bit ARGB value. |
SetBackgroundColor(const Aspose::Cells::Color& value) | Gets or sets a style’s background color. |
SetBackgroundThemeColor(const ThemeColor& value) | Gets and sets the background theme color. |
SetBorder(BorderType borderType, CellBorderType borderStyle, const Aspose::Cells::Color& borderColor) | Sets the borders of the style. |
SetBorder(BorderType borderType, CellBorderType borderStyle, const CellsColor& borderColor) | Sets the borders of the style. |
SetCultureCustom(const U16String& value) | 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. |
SetCultureCustom(const char16_t* value) | 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. |
SetCustom(const U16String& custom, bool builtinPreference) | Sets the Custom number format string of a cell. |
SetCustom(const char16_t* custom, bool builtinPreference) | Sets the Custom number format string of a cell. |
SetCustom(const U16String& value) | Represents the custom number format string of this style object. If the custom number format is not set(For example, the number format is builtin), "" will be returned. |
SetCustom(const char16_t* value) | Represents the custom number format string of this style object. If the custom number format is not set(For example, the number format is builtin), "" will be returned. |
SetForegroundArgbColor(int32_t value) | Gets and sets the foreground color with a 32-bit ARGB value. |
SetForegroundColor(const Aspose::Cells::Color& value) | Gets or sets a style’s foreground color. |
SetForegroundThemeColor(const ThemeColor& value) | Gets and sets the foreground theme color. |
SetHorizontalAlignment(TextAlignmentType value) | Gets or sets the horizontal alignment type of the text in a cell. |
SetIndentLevel(int32_t value) | Represents the indent level for the cell or range. Can only be an integer from 0 to 250. |
SetIsAlignmentApplied(bool value) | Indicate whether the alignment formatting should be applied. |
SetIsBorderApplied(bool value) | Indicate whether the border formatting should be applied. |
SetIsFillApplied(bool value) | Indicate whether the fill formatting should be applied. |
SetIsFontApplied(bool value) | Indicate whether the font formatting should be applied. |
SetIsFormulaHidden(bool value) | Represents if the formula will be hidden when the worksheet is protected. |
SetIsGradient(bool value) | Indicates whether the cell shading is a gradient pattern. |
SetIsJustifyDistributed(bool value) | Indicates if the cells justified or distributed alignment should be used on the last line of text. |
SetIsLocked(bool value) | Gets or sets a value indicating whether a cell can be modified or not. |
SetIsNumberFormatApplied(bool value) | Indicate whether the number formatting should be applied. |
SetIsProtectionApplied(bool value) | Indicate whether the protection formatting should be applied. |
SetIsTextWrapped(bool value) | Gets or sets a value indicating whether the text within a cell is wrapped. |
SetName(const U16String& value) | Gets or sets the name of the style. |
SetName(const char16_t* value) | Gets or sets the name of the style. |
SetNumber(int32_t value) | Gets or sets the display format of numbers and dates. The formatting patterns are different for different regions. |
SetPattern(BackgroundType value) | Gets or sets the cell background pattern type. |
SetPatternColor(BackgroundType pattern, const Aspose::Cells::Color& color1, const Aspose::Cells::Color& color2) | Sets the background color. |
SetQuotePrefix(bool value) | Indicates whether the cell’s value starts with single quote mark. |
SetRotationAngle(int32_t value) | Represents text rotation angle. |
SetShrinkToFit(bool value) | Represents if text automatically shrinks to fit in the available column width. |
SetTextDirection(TextDirectionType value) | Represents text reading order. |
SetTwoColorGradient(const Aspose::Cells::Color& color1, const Aspose::Cells::Color& color2, GradientStyleType gradientStyleType, int32_t variant) | Sets the specified fill to a two-color gradient. |
SetVerticalAlignment(TextAlignmentType value) | Gets or sets the vertical alignment type of the text in a cell. |
Style(Style_Impl* impl) | Constructs from an implementation object. |
Style(const Style& src) | Copy constructor. |
ToJson() | Convert Style to JSON struct data. |
Update() | 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. |
~Style() | Destructor. |
Fields
Field | Description |
---|---|
_impl | The implementation object. |
Examples
Aspose::Cells::Startup();
Workbook workbook;
WorksheetCollection sheets = workbook.GetWorksheets();
Cell cell = sheets.Get(0).GetCells().Get(u"A1");
Style style = cell.GetStyle();
style.GetFont().SetName(u"Times New Roman");
style.GetFont().SetColor(Color{ 0xff, 0, 0, 0xff });//Blue
cell.SetStyle(style);
Aspose::Cells::Cleanup();
See Also
- Namespace Aspose::Cells
- Library Aspose.Cells for C++