Style

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;

Example

//First method
const { Workbook, Color } = require("aspose.cells.node");

var excel = new Workbook();
var style = excel.createStyle();
style.font.setName("Times New Roman");
style.font.setColor(Color.Blue);
for (var i = 0; i < 100; i++) {
    excel.worksheets.get(0).cells.get(0, i).setStyle(style);
}

//Second method
var style1 = excel.worksheets.get(0).cells.get("A1").getStyle();
style1.font.setName("Times New Roman");
style1.font.color = Color.Blue;
excel.worksheets.get(0).cells.get("A1").setStyle(style1);

//First method is a fast and efficient way to change several cell-formatting properties on multiple cells at the same time.
//If you want to change a single cell's style properties, second method can be used.

Properties

PropertyTypeDescription
backgroundThemeColorThemeColorGets and sets the background theme color.
foregroundThemeColorThemeColorGets and sets the foreground theme color.
namestringGets or sets the name of the style.
patternBackgroundTypeGets or sets the cell background pattern type.
bordersBorderCollectionReadonly. Gets the BorderCollection of the style.
backgroundColorColorGets or sets a style’s background color.
backgroundArgbColornumberGets and sets the background color with a 32-bit ARGB value.
foregroundColorColorGets or sets a style’s foreground color.
foregroundArgbColornumberGets and sets the foreground color with a 32-bit ARGB value.
hasBordersbooleanReadonly. Checks whether there are borders have been set for the style.
parentStyleStyleReadonly. Gets the parent style of this style.
isNumberFormatAppliedbooleanIndicate whether the number formatting should be applied.
isFontAppliedbooleanIndicate whether the font formatting should be applied.
isAlignmentAppliedbooleanIndicate whether the alignment formatting should be applied.
isBorderAppliedbooleanIndicate whether the border formatting should be applied.
isFillAppliedbooleanIndicate whether the fill formatting should be applied.
isProtectionAppliedbooleanIndicate whether the protection formatting should be applied.
indentLevelnumberRepresents the indent level for the cell or range. Can only be an integer from 0 to 250.
fontFontReadonly. Gets a Font object.
rotationAnglenumberRepresents text rotation angle.
horizontalAlignmentTextAlignmentTypeGets or sets the horizontal alignment type of the text in a cell.
verticalAlignmentTextAlignmentTypeGets or sets the vertical alignment type of the text in a cell.
isTextWrappedbooleanGets or sets a value indicating whether the text within a cell is wrapped.
numbernumberGets or sets the display format of numbers and dates. The formatting patterns are different for different regions.
isLockedbooleanGets or sets a value indicating whether a cell can be modified or not.
customstringRepresents 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.
cultureCustomstringGets 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.
invariantCustomstringReadonly. 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.
isFormulaHiddenbooleanRepresents if the formula will be hidden when the worksheet is protected.
shrinkToFitbooleanRepresents if text automatically shrinks to fit in the available column width.
textDirectionTextDirectionTypeRepresents text reading order.
isJustifyDistributedbooleanIndicates if the cells justified or distributed alignment should be used on the last line of text.
quotePrefixbooleanIndicates whether the cell’s value starts with single quote mark.
isGradientbooleanIndicates whether the cell shading is a gradient pattern.
isPercentbooleanReadonly. Indicates whether the number format is a percent format.
isDateTimebooleanReadonly. Indicates whether the number format is a date format.

Methods

MethodDescription
getBackgroundThemeColor()@deprecated. Please use the ‘backgroundThemeColor’ property instead. Gets and sets the background theme color.
setBackgroundThemeColor(ThemeColor)@deprecated. Please use the ‘backgroundThemeColor’ property instead. Gets and sets the background theme color.
getForegroundThemeColor()@deprecated. Please use the ‘foregroundThemeColor’ property instead. Gets and sets the foreground theme color.
setForegroundThemeColor(ThemeColor)@deprecated. Please use the ‘foregroundThemeColor’ property instead. Gets and sets the foreground theme color.
getName()@deprecated. Please use the ’name’ property instead. Gets or sets the name of the style.
setName(string)@deprecated. Please use the ’name’ property instead. Gets or sets the name of the style.
getPattern()@deprecated. Please use the ‘pattern’ property instead. Gets or sets the cell background pattern type.
setPattern(BackgroundType)@deprecated. Please use the ‘pattern’ property instead. Gets or sets the cell background pattern type.
getBorders()@deprecated. Please use the ‘borders’ property instead. Gets the BorderCollection of the style.
getBackgroundColor()@deprecated. Please use the ‘backgroundColor’ property instead. Gets or sets a style’s background color.
setBackgroundColor(Color)@deprecated. Please use the ‘backgroundColor’ property instead. Gets or sets a style’s background color.
getBackgroundArgbColor()@deprecated. Please use the ‘backgroundArgbColor’ property instead. Gets and sets the background color with a 32-bit ARGB value.
setBackgroundArgbColor(number)@deprecated. Please use the ‘backgroundArgbColor’ property instead. Gets and sets the background color with a 32-bit ARGB value.
getForegroundColor()@deprecated. Please use the ‘foregroundColor’ property instead. Gets or sets a style’s foreground color.
setForegroundColor(Color)@deprecated. Please use the ‘foregroundColor’ property instead. Gets or sets a style’s foreground color.
getForegroundArgbColor()@deprecated. Please use the ‘foregroundArgbColor’ property instead. Gets and sets the foreground color with a 32-bit ARGB value.
setForegroundArgbColor(number)@deprecated. Please use the ‘foregroundArgbColor’ property instead. Gets and sets the foreground color with a 32-bit ARGB value.
getHasBorders()@deprecated. Please use the ‘hasBorders’ property instead. Checks whether there are borders have been set for the style.
getParentStyle()@deprecated. Please use the ‘parentStyle’ property instead. Gets the parent style of this style.
isNumberFormatApplied()@deprecated. Please use the ‘isNumberFormatApplied’ property instead. Indicate whether the number formatting should be applied.
setIsNumberFormatApplied(boolean)@deprecated. Please use the ‘isNumberFormatApplied’ property instead. Indicate whether the number formatting should be applied.
isFontApplied()@deprecated. Please use the ‘isFontApplied’ property instead. Indicate whether the font formatting should be applied.
setIsFontApplied(boolean)@deprecated. Please use the ‘isFontApplied’ property instead. Indicate whether the font formatting should be applied.
isAlignmentApplied()@deprecated. Please use the ‘isAlignmentApplied’ property instead. Indicate whether the alignment formatting should be applied.
setIsAlignmentApplied(boolean)@deprecated. Please use the ‘isAlignmentApplied’ property instead. Indicate whether the alignment formatting should be applied.
isBorderApplied()@deprecated. Please use the ‘isBorderApplied’ property instead. Indicate whether the border formatting should be applied.
setIsBorderApplied(boolean)@deprecated. Please use the ‘isBorderApplied’ property instead. Indicate whether the border formatting should be applied.
isFillApplied()@deprecated. Please use the ‘isFillApplied’ property instead. Indicate whether the fill formatting should be applied.
setIsFillApplied(boolean)@deprecated. Please use the ‘isFillApplied’ property instead. Indicate whether the fill formatting should be applied.
isProtectionApplied()@deprecated. Please use the ‘isProtectionApplied’ property instead. Indicate whether the protection formatting should be applied.
setIsProtectionApplied(boolean)@deprecated. Please use the ‘isProtectionApplied’ property instead. Indicate whether the protection formatting should be applied.
getIndentLevel()@deprecated. Please use the ‘indentLevel’ property instead. Represents the indent level for the cell or range. Can only be an integer from 0 to 250.
setIndentLevel(number)@deprecated. Please use the ‘indentLevel’ property instead. Represents the indent level for the cell or range. Can only be an integer from 0 to 250.
getFont()@deprecated. Please use the ‘font’ property instead. Gets a Font object.
getRotationAngle()@deprecated. Please use the ‘rotationAngle’ property instead. Represents text rotation angle.
setRotationAngle(number)@deprecated. Please use the ‘rotationAngle’ property instead. Represents text rotation angle.
getHorizontalAlignment()@deprecated. Please use the ‘horizontalAlignment’ property instead. Gets or sets the horizontal alignment type of the text in a cell.
setHorizontalAlignment(TextAlignmentType)@deprecated. Please use the ‘horizontalAlignment’ property instead. Gets or sets the horizontal alignment type of the text in a cell.
getVerticalAlignment()@deprecated. Please use the ‘verticalAlignment’ property instead. Gets or sets the vertical alignment type of the text in a cell.
setVerticalAlignment(TextAlignmentType)@deprecated. Please use the ‘verticalAlignment’ property instead. Gets or sets the vertical alignment type of the text in a cell.
isTextWrapped()@deprecated. Please use the ‘isTextWrapped’ property instead. Gets or sets a value indicating whether the text within a cell is wrapped.
setIsTextWrapped(boolean)@deprecated. Please use the ‘isTextWrapped’ property instead. Gets or sets a value indicating whether the text within a cell is wrapped.
getNumber()@deprecated. Please use the ’number’ property instead. Gets or sets the display format of numbers and dates. The formatting patterns are different for different regions.
setNumber(number)@deprecated. Please use the ’number’ property instead. Gets or sets the display format of numbers and dates. The formatting patterns are different for different regions.
isLocked()@deprecated. Please use the ‘isLocked’ property instead. Gets or sets a value indicating whether a cell can be modified or not.
setIsLocked(boolean)@deprecated. Please use the ‘isLocked’ property instead. Gets or sets a value indicating whether a cell can be modified or not.
getCustom()@deprecated. Please use the ‘custom’ property instead. 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(string)@deprecated. Please use the ‘custom’ property instead. 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.
getCultureCustom()@deprecated. Please use the ‘cultureCustom’ property instead. 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(string)@deprecated. Please use the ‘cultureCustom’ property instead. 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.
getInvariantCustom()@deprecated. Please use the ‘invariantCustom’ property instead. 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.
isFormulaHidden()@deprecated. Please use the ‘isFormulaHidden’ property instead. Represents if the formula will be hidden when the worksheet is protected.
setIsFormulaHidden(boolean)@deprecated. Please use the ‘isFormulaHidden’ property instead. Represents if the formula will be hidden when the worksheet is protected.
getShrinkToFit()@deprecated. Please use the ‘shrinkToFit’ property instead. Represents if text automatically shrinks to fit in the available column width.
setShrinkToFit(boolean)@deprecated. Please use the ‘shrinkToFit’ property instead. Represents if text automatically shrinks to fit in the available column width.
getTextDirection()@deprecated. Please use the ’textDirection’ property instead. Represents text reading order.
setTextDirection(TextDirectionType)@deprecated. Please use the ’textDirection’ property instead. Represents text reading order.
isJustifyDistributed()@deprecated. Please use the ‘isJustifyDistributed’ property instead. Indicates if the cells justified or distributed alignment should be used on the last line of text.
setIsJustifyDistributed(boolean)@deprecated. Please use the ‘isJustifyDistributed’ property instead. Indicates if the cells justified or distributed alignment should be used on the last line of text.
getQuotePrefix()@deprecated. Please use the ‘quotePrefix’ property instead. Indicates whether the cell’s value starts with single quote mark.
setQuotePrefix(boolean)@deprecated. Please use the ‘quotePrefix’ property instead. Indicates whether the cell’s value starts with single quote mark.
isGradient()@deprecated. Please use the ‘isGradient’ property instead. Indicates whether the cell shading is a gradient pattern.
setIsGradient(boolean)@deprecated. Please use the ‘isGradient’ property instead. Indicates whether the cell shading is a gradient pattern.
isPercent()@deprecated. Please use the ‘isPercent’ property instead. Indicates whether the number format is a percent format.
isDateTime()@deprecated. Please use the ‘isDateTime’ property instead. Indicates whether the number format is a date format.
setPatternColor(BackgroundType, Color, Color)Sets the background color.
copy(Style)Copies data from another style object
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.
isModified(StyleModifyFlag)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.
setBorder(BorderType, CellBorderType, Color)Sets the borders of the style.
setBorder(BorderType, CellBorderType, CellsColor)Sets the borders of the style.
setCustom(string, boolean)Sets the Custom number format string of a cell.
setTwoColorGradient(Color, Color, GradientStyleType, number)Sets the specified fill to a two-color gradient.
getTwoColorGradientSetting()Get the two-color gradient setting.
toJson()Convert Style to JSON struct data.
isNull()Checks whether the implementation object is null.
equals(Object)Determines whether two Style instances are equal.
getHashCode()Serves as a hash function for a Style object.

backgroundThemeColor

Gets and sets the background theme color.

backgroundThemeColor : ThemeColor;

Remarks

If the background color is not a theme color, NULL will be returned.

foregroundThemeColor

Gets and sets the foreground theme color.

foregroundThemeColor : ThemeColor;

Remarks

If the foreground color is not a theme color, NULL will be returned.

name

Gets or sets the name of the style.

name : string;

pattern

Gets or sets the cell background pattern type.

pattern : BackgroundType;

borders

Readonly. Gets the BorderCollection of the style.

borders : BorderCollection;

backgroundColor

Gets or sets a style’s background color.

backgroundColor : Color;

Remarks

If you want to set a cell’s color, please use Style.ForegroundColor property. Only if the cell style pattern is other than none or solid, this property will take effect.

backgroundArgbColor

Gets and sets the background color with a 32-bit ARGB value.

backgroundArgbColor : number;

foregroundColor

Gets or sets a style’s foreground color.

foregroundColor : Color;

Remarks

It means no color setting if Color.Empty is returned.

foregroundArgbColor

Gets and sets the foreground color with a 32-bit ARGB value.

foregroundArgbColor : number;

hasBorders

Readonly. Checks whether there are borders have been set for the style.

hasBorders : boolean;

parentStyle

Readonly. Gets the parent style of this style.

parentStyle : Style;

isNumberFormatApplied

Indicate whether the number formatting should be applied.

isNumberFormatApplied : boolean;

Remarks

Only for named style.

isFontApplied

Indicate whether the font formatting should be applied.

isFontApplied : boolean;

Remarks

Only for named style.

isAlignmentApplied

Indicate whether the alignment formatting should be applied.

isAlignmentApplied : boolean;

Remarks

Only for named style.

isBorderApplied

Indicate whether the border formatting should be applied.

isBorderApplied : boolean;

Remarks

Only for named style.

isFillApplied

Indicate whether the fill formatting should be applied.

isFillApplied : boolean;

Remarks

Only for named style.

isProtectionApplied

Indicate whether the protection formatting should be applied.

isProtectionApplied : boolean;

Remarks

Only for named style.

indentLevel

Represents the indent level for the cell or range. Can only be an integer from 0 to 250.

indentLevel : number;

Remarks

If text horizontal alignment type is set to value other than left or right, indent level will be reset to zero.

font

Readonly. Gets a Font object.

font : Font;

rotationAngle

Represents text rotation angle.

rotationAngle : number;

Remarks

0: Not rotated.

255: Top to Bottom.

-90: Downward.

90: Upward.

You can set 255 or value ranged from -90 to 90.

horizontalAlignment

Gets or sets the horizontal alignment type of the text in a cell.

horizontalAlignment : TextAlignmentType;

verticalAlignment

Gets or sets the vertical alignment type of the text in a cell.

verticalAlignment : TextAlignmentType;

isTextWrapped

Gets or sets a value indicating whether the text within a cell is wrapped.

isTextWrapped : boolean;

number

Gets or sets the display format of numbers and dates. The formatting patterns are different for different regions.

number : number;

Remarks

For example, the formatting patterns represented by numbers for en_US region: Value Type Format String 0 General General 1 Decimal 0 2 Decimal 0.00 3 Decimal #,##0 4 Decimal #,##0.00 5 Currency $#,##0_);($#,##0) 6 Currency $#,##0_);Red 7 Currency $#,##0.00_);($#,##0.00) 8 Currency $#,##0.00_);Red 9 Percentage 0% 10 Percentage 0.00% 11 Scientific 0.00E+00 12 Fraction # ?/? 13 Fraction # ??/?? 14 Date m/d/yyyy 15 Date d-mmm-yy 16 Date d-mmm 17 Date mmm-yy 18 Time h:mm AM/PM 19 Time h:mm:ss AM/PM 20 Time h:mm 21 Time h:mm:ss 22 Time m/d/yyyy h:mm 37 Accounting #,##0_);(#,##0) 38 Accounting #,##0_);Red 39 Accounting #,##0.00_);(#,##0.00) 40 Accounting #,##0.00_);Red 41 Accounting (* #,##0);(* (#,##0);(* “-”);(@) 42 Currency ($* #,##0_);($* (#,##0);($* “-”);(@) 43 Accounting (* #,##0.00_);(* (#,##0.00);(* “-”??);(@) 44 Currency ($* #,##0.00_);($* (#,##0.00);($* “-”??);(@_) 45 Time mm:ss 46 Time [h]:mm:ss 47 Time mm:ss.0 48 Scientific ##0.0E+0 49 Text @ </list

isLocked

Gets or sets a value indicating whether a cell can be modified or not.

isLocked : boolean;

Remarks

Locking cells has no effect unless the worksheet is protected.

custom

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.

custom : string;

Remarks

The returned custom string is culture-independent.

cultureCustom

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.

cultureCustom : string;

Remarks

For builtin number format, both the pattern content(such as, one builtin date format is “m/d/y” for some locales, but for some other locales it becomes “d/m/y”) and the format specifier(such as, some locales is using character other than ‘y’ to represent the year part for date formatting) are culture-dependent; For user specified custom format, only format specifiers are changed according to the culture, other parts of the formatting pattern will not be modified.

invariantCustom

Readonly. 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.

invariantCustom : string;

Remarks

For builtin number formats, the returned pattern content is still culture-dependent, such as, for some locales it returns “m/d/y” and for some other locales it returns “d/m/y”. The difference from CultureCustom is(that is also what culture-independent means): the format specifiers and separators are kept as standard, such as ‘/’ will always be used as datetime separator and “y” will always be used as the “year” part no matter what other special character is used for the specific locale.

isFormulaHidden

Represents if the formula will be hidden when the worksheet is protected.

isFormulaHidden : boolean;

shrinkToFit

Represents if text automatically shrinks to fit in the available column width.

shrinkToFit : boolean;

textDirection

Represents text reading order.

textDirection : TextDirectionType;

isJustifyDistributed

Indicates if the cells justified or distributed alignment should be used on the last line of text.

isJustifyDistributed : boolean;

Remarks

This is typical for East Asian alignments but not typical in other contexts.

quotePrefix

Indicates whether the cell’s value starts with single quote mark.

quotePrefix : boolean;

isGradient

Indicates whether the cell shading is a gradient pattern.

isGradient : boolean;

isPercent

Readonly. Indicates whether the number format is a percent format.

isPercent : boolean;

isDateTime

Readonly. Indicates whether the number format is a date format.

isDateTime : boolean;

getBackgroundThemeColor()

@deprecated. Please use the ‘backgroundThemeColor’ property instead. Gets and sets the background theme color.

getBackgroundThemeColor() : ThemeColor;

Returns

ThemeColor

Remarks

If the background color is not a theme color, NULL will be returned.

setBackgroundThemeColor(ThemeColor)

@deprecated. Please use the ‘backgroundThemeColor’ property instead. Gets and sets the background theme color.

setBackgroundThemeColor(value: ThemeColor) : void;

Parameters:

ParameterTypeDescription
valueThemeColorThe value to set.

Remarks

If the background color is not a theme color, NULL will be returned.

getForegroundThemeColor()

@deprecated. Please use the ‘foregroundThemeColor’ property instead. Gets and sets the foreground theme color.

getForegroundThemeColor() : ThemeColor;

Returns

ThemeColor

Remarks

If the foreground color is not a theme color, NULL will be returned.

setForegroundThemeColor(ThemeColor)

@deprecated. Please use the ‘foregroundThemeColor’ property instead. Gets and sets the foreground theme color.

setForegroundThemeColor(value: ThemeColor) : void;

Parameters:

ParameterTypeDescription
valueThemeColorThe value to set.

Remarks

If the foreground color is not a theme color, NULL will be returned.

getName()

@deprecated. Please use the ’name’ property instead. Gets or sets the name of the style.

getName() : string;

setName(string)

@deprecated. Please use the ’name’ property instead. Gets or sets the name of the style.

setName(value: string) : void;

Parameters:

ParameterTypeDescription
valuestringThe value to set.

getPattern()

@deprecated. Please use the ‘pattern’ property instead. Gets or sets the cell background pattern type.

getPattern() : BackgroundType;

Returns

BackgroundType

setPattern(BackgroundType)

@deprecated. Please use the ‘pattern’ property instead. Gets or sets the cell background pattern type.

setPattern(value: BackgroundType) : void;

Parameters:

ParameterTypeDescription
valueBackgroundTypeThe value to set.

getBorders()

@deprecated. Please use the ‘borders’ property instead. Gets the BorderCollection of the style.

getBorders() : BorderCollection;

Returns

BorderCollection

getBackgroundColor()

@deprecated. Please use the ‘backgroundColor’ property instead. Gets or sets a style’s background color.

getBackgroundColor() : Color;

Returns

Color

Remarks

If you want to set a cell’s color, please use Style.ForegroundColor property. Only if the cell style pattern is other than none or solid, this property will take effect.

setBackgroundColor(Color)

@deprecated. Please use the ‘backgroundColor’ property instead. Gets or sets a style’s background color.

setBackgroundColor(value: Color) : void;

Parameters:

ParameterTypeDescription
valueColorThe value to set.

Remarks

If you want to set a cell’s color, please use Style.ForegroundColor property. Only if the cell style pattern is other than none or solid, this property will take effect.

getBackgroundArgbColor()

@deprecated. Please use the ‘backgroundArgbColor’ property instead. Gets and sets the background color with a 32-bit ARGB value.

getBackgroundArgbColor() : number;

setBackgroundArgbColor(number)

@deprecated. Please use the ‘backgroundArgbColor’ property instead. Gets and sets the background color with a 32-bit ARGB value.

setBackgroundArgbColor(value: number) : void;

Parameters:

ParameterTypeDescription
valuenumberThe value to set.

getForegroundColor()

@deprecated. Please use the ‘foregroundColor’ property instead. Gets or sets a style’s foreground color.

getForegroundColor() : Color;

Returns

Color

Remarks

It means no color setting if Color.Empty is returned.

setForegroundColor(Color)

@deprecated. Please use the ‘foregroundColor’ property instead. Gets or sets a style’s foreground color.

setForegroundColor(value: Color) : void;

Parameters:

ParameterTypeDescription
valueColorThe value to set.

Remarks

It means no color setting if Color.Empty is returned.

getForegroundArgbColor()

@deprecated. Please use the ‘foregroundArgbColor’ property instead. Gets and sets the foreground color with a 32-bit ARGB value.

getForegroundArgbColor() : number;

setForegroundArgbColor(number)

@deprecated. Please use the ‘foregroundArgbColor’ property instead. Gets and sets the foreground color with a 32-bit ARGB value.

setForegroundArgbColor(value: number) : void;

Parameters:

ParameterTypeDescription
valuenumberThe value to set.

getHasBorders()

@deprecated. Please use the ‘hasBorders’ property instead. Checks whether there are borders have been set for the style.

getHasBorders() : boolean;

getParentStyle()

@deprecated. Please use the ‘parentStyle’ property instead. Gets the parent style of this style.

getParentStyle() : Style;

Returns

Style

isNumberFormatApplied()

@deprecated. Please use the ‘isNumberFormatApplied’ property instead. Indicate whether the number formatting should be applied.

isNumberFormatApplied() : boolean;

Remarks

Only for named style.

setIsNumberFormatApplied(boolean)

@deprecated. Please use the ‘isNumberFormatApplied’ property instead. Indicate whether the number formatting should be applied.

setIsNumberFormatApplied(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

Remarks

Only for named style.

isFontApplied()

@deprecated. Please use the ‘isFontApplied’ property instead. Indicate whether the font formatting should be applied.

isFontApplied() : boolean;

Remarks

Only for named style.

setIsFontApplied(boolean)

@deprecated. Please use the ‘isFontApplied’ property instead. Indicate whether the font formatting should be applied.

setIsFontApplied(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

Remarks

Only for named style.

isAlignmentApplied()

@deprecated. Please use the ‘isAlignmentApplied’ property instead. Indicate whether the alignment formatting should be applied.

isAlignmentApplied() : boolean;

Remarks

Only for named style.

setIsAlignmentApplied(boolean)

@deprecated. Please use the ‘isAlignmentApplied’ property instead. Indicate whether the alignment formatting should be applied.

setIsAlignmentApplied(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

Remarks

Only for named style.

isBorderApplied()

@deprecated. Please use the ‘isBorderApplied’ property instead. Indicate whether the border formatting should be applied.

isBorderApplied() : boolean;

Remarks

Only for named style.

setIsBorderApplied(boolean)

@deprecated. Please use the ‘isBorderApplied’ property instead. Indicate whether the border formatting should be applied.

setIsBorderApplied(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

Remarks

Only for named style.

isFillApplied()

@deprecated. Please use the ‘isFillApplied’ property instead. Indicate whether the fill formatting should be applied.

isFillApplied() : boolean;

Remarks

Only for named style.

setIsFillApplied(boolean)

@deprecated. Please use the ‘isFillApplied’ property instead. Indicate whether the fill formatting should be applied.

setIsFillApplied(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

Remarks

Only for named style.

isProtectionApplied()

@deprecated. Please use the ‘isProtectionApplied’ property instead. Indicate whether the protection formatting should be applied.

isProtectionApplied() : boolean;

Remarks

Only for named style.

setIsProtectionApplied(boolean)

@deprecated. Please use the ‘isProtectionApplied’ property instead. Indicate whether the protection formatting should be applied.

setIsProtectionApplied(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

Remarks

Only for named style.

getIndentLevel()

@deprecated. Please use the ‘indentLevel’ property instead. Represents the indent level for the cell or range. Can only be an integer from 0 to 250.

getIndentLevel() : number;

Remarks

If text horizontal alignment type is set to value other than left or right, indent level will be reset to zero.

setIndentLevel(number)

@deprecated. Please use the ‘indentLevel’ property instead. Represents the indent level for the cell or range. Can only be an integer from 0 to 250.

setIndentLevel(value: number) : void;

Parameters:

ParameterTypeDescription
valuenumberThe value to set.

Remarks

If text horizontal alignment type is set to value other than left or right, indent level will be reset to zero.

getFont()

@deprecated. Please use the ‘font’ property instead. Gets a Font object.

getFont() : Font;

Returns

Font

getRotationAngle()

@deprecated. Please use the ‘rotationAngle’ property instead. Represents text rotation angle.

getRotationAngle() : number;

Remarks

0: Not rotated.

255: Top to Bottom.

-90: Downward.

90: Upward.

You can set 255 or value ranged from -90 to 90.

setRotationAngle(number)

@deprecated. Please use the ‘rotationAngle’ property instead. Represents text rotation angle.

setRotationAngle(value: number) : void;

Parameters:

ParameterTypeDescription
valuenumberThe value to set.

Remarks

0: Not rotated.

255: Top to Bottom.

-90: Downward.

90: Upward.

You can set 255 or value ranged from -90 to 90.

getHorizontalAlignment()

@deprecated. Please use the ‘horizontalAlignment’ property instead. Gets or sets the horizontal alignment type of the text in a cell.

getHorizontalAlignment() : TextAlignmentType;

Returns

TextAlignmentType

setHorizontalAlignment(TextAlignmentType)

@deprecated. Please use the ‘horizontalAlignment’ property instead. Gets or sets the horizontal alignment type of the text in a cell.

setHorizontalAlignment(value: TextAlignmentType) : void;

Parameters:

ParameterTypeDescription
valueTextAlignmentTypeThe value to set.

getVerticalAlignment()

@deprecated. Please use the ‘verticalAlignment’ property instead. Gets or sets the vertical alignment type of the text in a cell.

getVerticalAlignment() : TextAlignmentType;

Returns

TextAlignmentType

setVerticalAlignment(TextAlignmentType)

@deprecated. Please use the ‘verticalAlignment’ property instead. Gets or sets the vertical alignment type of the text in a cell.

setVerticalAlignment(value: TextAlignmentType) : void;

Parameters:

ParameterTypeDescription
valueTextAlignmentTypeThe value to set.

isTextWrapped()

@deprecated. Please use the ‘isTextWrapped’ property instead. Gets or sets a value indicating whether the text within a cell is wrapped.

isTextWrapped() : boolean;

setIsTextWrapped(boolean)

@deprecated. Please use the ‘isTextWrapped’ property instead. Gets or sets a value indicating whether the text within a cell is wrapped.

setIsTextWrapped(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

getNumber()

@deprecated. Please use the ’number’ property instead. Gets or sets the display format of numbers and dates. The formatting patterns are different for different regions.

getNumber() : number;

Remarks

For example, the formatting patterns represented by numbers for en_US region: Value Type Format String 0 General General 1 Decimal 0 2 Decimal 0.00 3 Decimal #,##0 4 Decimal #,##0.00 5 Currency $#,##0_);($#,##0) 6 Currency $#,##0_);Red 7 Currency $#,##0.00_);($#,##0.00) 8 Currency $#,##0.00_);Red 9 Percentage 0% 10 Percentage 0.00% 11 Scientific 0.00E+00 12 Fraction # ?/? 13 Fraction # ??/?? 14 Date m/d/yyyy 15 Date d-mmm-yy 16 Date d-mmm 17 Date mmm-yy 18 Time h:mm AM/PM 19 Time h:mm:ss AM/PM 20 Time h:mm 21 Time h:mm:ss 22 Time m/d/yyyy h:mm 37 Accounting #,##0_);(#,##0) 38 Accounting #,##0_);Red 39 Accounting #,##0.00_);(#,##0.00) 40 Accounting #,##0.00_);Red 41 Accounting (* #,##0);(* (#,##0);(* “-”);(@) 42 Currency ($* #,##0_);($* (#,##0);($* “-”);(@) 43 Accounting (* #,##0.00_);(* (#,##0.00);(* “-”??);(@) 44 Currency ($* #,##0.00_);($* (#,##0.00);($* “-”??);(@_) 45 Time mm:ss 46 Time [h]:mm:ss 47 Time mm:ss.0 48 Scientific ##0.0E+0 49 Text @ </list

setNumber(number)

@deprecated. Please use the ’number’ property instead. Gets or sets the display format of numbers and dates. The formatting patterns are different for different regions.

setNumber(value: number) : void;

Parameters:

ParameterTypeDescription
valuenumberThe value to set.

Remarks

For example, the formatting patterns represented by numbers for en_US region: Value Type Format String 0 General General 1 Decimal 0 2 Decimal 0.00 3 Decimal #,##0 4 Decimal #,##0.00 5 Currency $#,##0_);($#,##0) 6 Currency $#,##0_);Red 7 Currency $#,##0.00_);($#,##0.00) 8 Currency $#,##0.00_);Red 9 Percentage 0% 10 Percentage 0.00% 11 Scientific 0.00E+00 12 Fraction # ?/? 13 Fraction # ??/?? 14 Date m/d/yyyy 15 Date d-mmm-yy 16 Date d-mmm 17 Date mmm-yy 18 Time h:mm AM/PM 19 Time h:mm:ss AM/PM 20 Time h:mm 21 Time h:mm:ss 22 Time m/d/yyyy h:mm 37 Accounting #,##0_);(#,##0) 38 Accounting #,##0_);Red 39 Accounting #,##0.00_);(#,##0.00) 40 Accounting #,##0.00_);Red 41 Accounting (* #,##0);(* (#,##0);(* “-”);(@) 42 Currency ($* #,##0_);($* (#,##0);($* “-”);(@) 43 Accounting (* #,##0.00_);(* (#,##0.00);(* “-”??);(@) 44 Currency ($* #,##0.00_);($* (#,##0.00);($* “-”??);(@_) 45 Time mm:ss 46 Time [h]:mm:ss 47 Time mm:ss.0 48 Scientific ##0.0E+0 49 Text @ </list

isLocked()

@deprecated. Please use the ‘isLocked’ property instead. Gets or sets a value indicating whether a cell can be modified or not.

isLocked() : boolean;

Remarks

Locking cells has no effect unless the worksheet is protected.

setIsLocked(boolean)

@deprecated. Please use the ‘isLocked’ property instead. Gets or sets a value indicating whether a cell can be modified or not.

setIsLocked(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

Remarks

Locking cells has no effect unless the worksheet is protected.

getCustom()

@deprecated. Please use the ‘custom’ property instead. 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.

getCustom() : string;

Remarks

The returned custom string is culture-independent.

setCustom(string)

@deprecated. Please use the ‘custom’ property instead. 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(value: string) : void;

Parameters:

ParameterTypeDescription
valuestringThe value to set.

Remarks

The returned custom string is culture-independent.

getCultureCustom()

@deprecated. Please use the ‘cultureCustom’ property instead. 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.

getCultureCustom() : string;

Remarks

For builtin number format, both the pattern content(such as, one builtin date format is “m/d/y” for some locales, but for some other locales it becomes “d/m/y”) and the format specifier(such as, some locales is using character other than ‘y’ to represent the year part for date formatting) are culture-dependent; For user specified custom format, only format specifiers are changed according to the culture, other parts of the formatting pattern will not be modified.

setCultureCustom(string)

@deprecated. Please use the ‘cultureCustom’ property instead. 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(value: string) : void;

Parameters:

ParameterTypeDescription
valuestringThe value to set.

Remarks

For builtin number format, both the pattern content(such as, one builtin date format is “m/d/y” for some locales, but for some other locales it becomes “d/m/y”) and the format specifier(such as, some locales is using character other than ‘y’ to represent the year part for date formatting) are culture-dependent; For user specified custom format, only format specifiers are changed according to the culture, other parts of the formatting pattern will not be modified.

getInvariantCustom()

@deprecated. Please use the ‘invariantCustom’ property instead. 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.

getInvariantCustom() : string;

Remarks

For builtin number formats, the returned pattern content is still culture-dependent, such as, for some locales it returns “m/d/y” and for some other locales it returns “d/m/y”. The difference from CultureCustom is(that is also what culture-independent means): the format specifiers and separators are kept as standard, such as ‘/’ will always be used as datetime separator and “y” will always be used as the “year” part no matter what other special character is used for the specific locale.

isFormulaHidden()

@deprecated. Please use the ‘isFormulaHidden’ property instead. Represents if the formula will be hidden when the worksheet is protected.

isFormulaHidden() : boolean;

setIsFormulaHidden(boolean)

@deprecated. Please use the ‘isFormulaHidden’ property instead. Represents if the formula will be hidden when the worksheet is protected.

setIsFormulaHidden(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

getShrinkToFit()

@deprecated. Please use the ‘shrinkToFit’ property instead. Represents if text automatically shrinks to fit in the available column width.

getShrinkToFit() : boolean;

setShrinkToFit(boolean)

@deprecated. Please use the ‘shrinkToFit’ property instead. Represents if text automatically shrinks to fit in the available column width.

setShrinkToFit(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

getTextDirection()

@deprecated. Please use the ’textDirection’ property instead. Represents text reading order.

getTextDirection() : TextDirectionType;

Returns

TextDirectionType

setTextDirection(TextDirectionType)

@deprecated. Please use the ’textDirection’ property instead. Represents text reading order.

setTextDirection(value: TextDirectionType) : void;

Parameters:

ParameterTypeDescription
valueTextDirectionTypeThe value to set.

isJustifyDistributed()

@deprecated. Please use the ‘isJustifyDistributed’ property instead. Indicates if the cells justified or distributed alignment should be used on the last line of text.

isJustifyDistributed() : boolean;

Remarks

This is typical for East Asian alignments but not typical in other contexts.

setIsJustifyDistributed(boolean)

@deprecated. Please use the ‘isJustifyDistributed’ property instead. Indicates if the cells justified or distributed alignment should be used on the last line of text.

setIsJustifyDistributed(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

Remarks

This is typical for East Asian alignments but not typical in other contexts.

getQuotePrefix()

@deprecated. Please use the ‘quotePrefix’ property instead. Indicates whether the cell’s value starts with single quote mark.

getQuotePrefix() : boolean;

setQuotePrefix(boolean)

@deprecated. Please use the ‘quotePrefix’ property instead. Indicates whether the cell’s value starts with single quote mark.

setQuotePrefix(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

isGradient()

@deprecated. Please use the ‘isGradient’ property instead. Indicates whether the cell shading is a gradient pattern.

isGradient() : boolean;

setIsGradient(boolean)

@deprecated. Please use the ‘isGradient’ property instead. Indicates whether the cell shading is a gradient pattern.

setIsGradient(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

isPercent()

@deprecated. Please use the ‘isPercent’ property instead. Indicates whether the number format is a percent format.

isPercent() : boolean;

isDateTime()

@deprecated. Please use the ‘isDateTime’ property instead. Indicates whether the number format is a date format.

isDateTime() : boolean;

setPatternColor(BackgroundType, Color, Color)

Sets the background color.

setPatternColor(pattern: BackgroundType, color1: Color, color2: Color) : void;

Parameters:

ParameterTypeDescription
patternBackgroundTypeThe pattern.
color1ColorThe foreground color.
color2ColorThe background color. Only works when pattern is not BackgroundType.None and BackgroundType.Solid.

copy(Style)

Copies data from another style object

copy(style: Style) : void;

Parameters:

ParameterTypeDescription
styleStyleSource Style object

Remarks

This method does not copy the name of the style. If you want to copy the name, please call the following codes after copying style: destStyle.Name = style.Name.

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.

update() : void;

isModified(StyleModifyFlag)

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.

isModified(modifyFlag: StyleModifyFlag) : boolean;

Parameters:

ParameterTypeDescription
modifyFlagStyleModifyFlagStyle modified flags

Returns

true if the specified properties have been modified

setBorder(BorderType, CellBorderType, Color)

Sets the borders of the style.

setBorder(borderType: BorderType, borderStyle: CellBorderType, borderColor: Color) : boolean;

Parameters:

ParameterTypeDescription
borderTypeBorderTypeThe border(s) to be set, can be combination of BorderType.
borderStyleCellBorderTypeThe style of the border.
borderColorColorThe color of the border.

Returns

Whether current border settings have been changed.

setBorder(BorderType, CellBorderType, CellsColor)

Sets the borders of the style.

setBorder(borderType: BorderType, borderStyle: CellBorderType, borderColor: CellsColor) : boolean;

Parameters:

ParameterTypeDescription
borderTypeBorderTypeThe border(s) to be set, can be combination of BorderType.
borderStyleCellBorderTypeThe style of the border.
borderColorCellsColorThe color of the border.

Returns

Whether current border settings have been changed.

setCustom(string, boolean)

Sets the Custom number format string of a cell.

setCustom(custom: string, builtinPreference: boolean) : void;

Parameters:

ParameterTypeDescription
customstringCustom number format string, should be InvariantCulture pattern.
builtinPreferencebooleanIf given Custom number format string matches one of the built-in number formats /// corresponding to current regional settings, whether set the number format as built-in instead of Custom.

setTwoColorGradient(Color, Color, GradientStyleType, number)

Sets the specified fill to a two-color gradient.

setTwoColorGradient(color1: Color, color2: Color, gradientStyleType: GradientStyleType, variant: number) : void;

Parameters:

ParameterTypeDescription
color1ColorOne gradient color.
color2ColorTwo gradient color.
gradientStyleTypeGradientStyleTypeGradient shading style.
variantnumberThe gradient variant. Can be a value from 1 through 4, corresponding to one of the four variants on the Gradient tab in the Fill Effects dialog box. If style is GradientStyle.FromCenter, the Variant argument can only be 1 or 2.

getTwoColorGradientSetting()

Get the two-color gradient setting.

getTwoColorGradientSetting() : TwoColorGradient;

Returns

TwoColorGradient

toJson()

Convert Style to JSON struct data.

toJson() : string;

isNull()

Checks whether the implementation object is null.

isNull() : boolean;

equals(Object)

Determines whether two Style instances are equal.

equals(obj: Object) : boolean;

Parameters:

ParameterTypeDescription
objObjectThe Style object to compare with the current Style object.

Returns

true if the specified Object is equal to the current Object; otherwise, false.

getHashCode()

Serves as a hash function for a Style object.

getHashCode() : number;

Returns

A hash code for the current Object.

Remarks

This method is only for internal use.