CellStyle Class |
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Set text</para><para>worksheet["C2"].Text = "Sample";</para><para>//Add and set style</para><para>CellStyle style = workbook.Styles.Add("BorderStyle");</para><para>style.Color = Color.Red;</para><para>worksheet["C2"].Style = style;</para><para>//Save to file</para><para>workbook.SaveToFile("Style.xlsx");</para>
Namespace: Spire.Xls
The CellStyle type exposes the following members.
Name | Description | |
---|---|---|
![]() |
Borders |
Returns a Borders collection that represents the borders of a style.
|
![]() |
BuiltIn |
True if the style is a built-in style.
(Inherited from
CellStyleObject
.)
|
![]() |
Color |
Gets or sets the cell shading color.
(Inherited from
CellStyleObject
.)
|
![]() |
FillPattern |
Gets or Sets fill pattern type.
(Inherited from
CellStyleObject
.)
|
![]() |
Font |
Returns a Font object that represents the font of the specified object.
|
![]() |
FormulaHidden |
True if the formula will be hidden when the worksheet is protected.
(Inherited from
CellStyleObject
.)
|
![]() |
HorizontalAlignment |
Returns or sets the horizontal alignment for the specified object.
(Inherited from
CellStyleObject
.)
|
![]() |
IncludeAlignment |
True if the style includes the AddIndent, HorizontalAlignment,
VerticalAlignment, WrapText, and Orientation properties.
(Inherited from
CellStyleObject
.)
|
![]() |
IncludeBorder |
True if the style includes the Color, KnownColor, LineStyle, and Weight border properties
(Inherited from
CellStyleObject
.)
|
![]() |
IncludeFont |
True if the style includes the Background, Bold, Color, KnownColor, FontStyle, Italic, Name, OutlineFont, Shadow, Size, Strikethrough, Subscript, Superscript, and Underline font properties.
(Inherited from
CellStyleObject
.)
|
![]() |
IncludeNumberFormat |
True if the style includes the NumberFormat property.
(Inherited from
CellStyleObject
.)
|
![]() |
IncludePatterns |
True if the style includes the Color, KnownColor,
InvertIfNegative, Pattern, PatternColor, and PatternKnownColor
interior properties.
(Inherited from
CellStyleObject
.)
|
![]() |
IncludeProtection |
True if the style includes the FormulaHidden and Locked protection
properties.
(Inherited from
CellStyleObject
.)
|
![]() |
IndentLevel |
Returns or sets the indent level for the style.
(Inherited from
CellStyleObject
.)
|
![]() |
Interior |
Returns interior object for extended format.
|
![]() |
IsFirstSymbolApostrophe |
If true then first symbol in cell is apostrophe.
(Inherited from
CellStyleObject
.)
|
![]() |
IsInitialized |
Indicates whether style is initialized (differs from Normal style).
Read-only.
(Inherited from
CellStyleObject
.)
|
![]() |
IsModified |
Returns the style has been modified
(Inherited from
CellStyleObject
.)
|
![]() |
JustifyLast |
Represents justify text alignment
(Inherited from
CellStyleObject
.)
|
![]() |
KnownColor |
Gets or sets the cell shading excel color.
(Inherited from
CellStyleObject
.)
|
![]() |
Locked |
True if the object is locked; False if the object can be modified when the sheet is protected.
(Inherited from
CellStyleObject
.)
|
![]() |
Name |
Returns or sets the name of the object. Read-only String.
(Inherited from
CellStyleObject
.)
|
![]() |
NumberFormat |
Returns or sets the format code for the object.
(Inherited from
CellStyleObject
.)
|
![]() |
NumberFormatIndex |
Gets or Sets format index.
(Inherited from
CellStyleObject
.)
|
![]() |
NumberFormatLocal |
Returns or sets the format code for the object as a string in the
language of the user.
(Inherited from
CellStyleObject
.)
|
![]() |
NumberFormatSettings |
Returns object that describes number format. Read-only.
(Inherited from
CellStyleObject
.)
|
![]() |
Parent |
Get the parent.
(Inherited from
CellStyleObject
.)
|
![]() |
PatternColor |
Returns or sets the color of the interior pattern.
(Inherited from
CellStyleObject
.)
|
![]() |
PatternKnownColor |
Returns or sets the excel color of the interior.
(Inherited from
CellStyleObject
.)
|
![]() |
ReadingOrder |
Returns or sets the reading order for the specified object.
(Inherited from
CellStyleObject
.)
|
![]() |
Rotation |
The text orientation. Can be an integer value from 1 to 180 degrees
(Inherited from
CellStyleObject
.)
|
![]() |
ShrinkToFit |
True if text automatically shrinks to fit in the available column width.
(Inherited from
CellStyleObject
.)
|
![]() |
VerticalAlignment |
Returns or sets the vertical alignment of the specified object.
(Inherited from
CellStyleObject
.)
|
![]() |
WrapText |
True if Microsoft Excel wraps the text in the object.
(Inherited from
CellStyleObject
.)
|
Name | Description | |
---|---|---|
![]() |
BeginUpdate |
This method should be called before several updates to the object will take place.
(Inherited from
CellStyleObject
.)
|
![]() |
clone |
clone CellStyle
|
![]() |
clone(Workbook) |
clone CellStyle and add to book.Styles
|
![]() |
EndUpdate |
This method should be called after several updates to the object took place.
(Inherited from
CellStyleObject
.)
|
![]() |
Equals |
Determines whether the specified object is equal to the current object.
(Inherited from
Object
.)
|
![]() |
Finalize |
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from
Object
.)
|
![]() |
GetHashCode |
Serves as the default hash function.
(Inherited from
Object
.)
|
![]() |
GetThemeColor |
Get the theme color.
(Inherited from
CellStyleObject
.)
|
![]() |
GetType |
Gets the
Type
of the current instance.
(Inherited from
Object
.)
|
![]() |
MemberwiseClone |
Creates a shallow copy of the current
Object
.
(Inherited from
Object
.)
|
![]() |
SetThemeColor |
Set the theme color.
(Inherited from
CellStyleObject
.)
|
![]() |
ToString |
Returns a string that represents the current object.
(Inherited from
Object
.)
|