Class CellStyle
Represents a named style that can be applied to cells for consistent formatting.
Inherited Members
Namespace: DRIT.Spreadsheet
Assembly: DRIT.Spreadsheet.dll
Syntax
public class CellStyle
Remarks
A CellStyle encapsulates formatting properties including alignment, borders, fill, and font.
Styles can be built-in (like "Normal", "Heading 1") or custom user-defined styles.
Styles promote consistency across a workbook and make it easier to apply and modify formatting.
Examples
// Create and apply a custom style
var style = new CellStyle("MyStyle");
style.Font.Bold = true;
style.Fill = CellFill.Solid(Color.LightBlue);
range.SetStyle(style);
Constructors
CellStyle()
Initializes a new CellStyle for the supplied workbook data.
Declaration
public CellStyle()
Remarks
A CellStyle encapsulates formatting properties including alignment, borders, fill, and font.
Styles can be built-in (like "Normal", "Heading 1") or custom user-defined styles.
Styles promote consistency across a workbook and make it easier to apply and modify formatting.
CellStyle(byte)
Initializes a new CellStyle for the supplied workbook data.
Declaration
public CellStyle(byte builtinId)
Parameters
| Type | Name | Description |
|---|---|---|
| byte | builtinId |
Remarks
A CellStyle encapsulates formatting properties including alignment, borders, fill, and font.
Styles can be built-in (like "Normal", "Heading 1") or custom user-defined styles.
Styles promote consistency across a workbook and make it easier to apply and modify formatting.
CellStyle(byte, string)
Initializes a new CellStyle for the supplied workbook data.
Declaration
public CellStyle(byte builtinId, string name)
Parameters
| Type | Name | Description |
|---|---|---|
| byte | builtinId | |
| string | name |
Remarks
A CellStyle encapsulates formatting properties including alignment, borders, fill, and font.
Styles can be built-in (like "Normal", "Heading 1") or custom user-defined styles.
Styles promote consistency across a workbook and make it easier to apply and modify formatting.
CellStyle(string)
Initializes a new CellStyle for the supplied workbook data.
Declaration
public CellStyle(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name |
Remarks
A CellStyle encapsulates formatting properties including alignment, borders, fill, and font.
Styles can be built-in (like "Normal", "Heading 1") or custom user-defined styles.
Styles promote consistency across a workbook and make it easier to apply and modify formatting.
Properties
Alignment
Specifies the alignment settings for cells using this style.
Declaration
public virtual CellAlignment Alignment { get; set; }
Property Value
| Type | Description |
|---|---|
| CellAlignment |
Remarks
A CellStyle encapsulates formatting properties including alignment, borders, fill, and font.
Styles can be built-in (like "Normal", "Heading 1") or custom user-defined styles.
Styles promote consistency across a workbook and make it easier to apply and modify formatting.
Borders
Specifies the border settings for cells using this style.
Declaration
public virtual AbstractBorders Borders { get; set; }
Property Value
| Type | Description |
|---|---|
| AbstractBorders |
Remarks
A CellStyle encapsulates formatting properties including alignment, borders, fill, and font.
Styles can be built-in (like "Normal", "Heading 1") or custom user-defined styles.
Styles promote consistency across a workbook and make it easier to apply and modify formatting.
Fill
Specifies the fill (background) settings for cells using this style.
Declaration
public virtual CellFill Fill { get; set; }
Property Value
| Type | Description |
|---|---|
| CellFill |
Remarks
A CellStyle encapsulates formatting properties including alignment, borders, fill, and font.
Styles can be built-in (like "Normal", "Heading 1") or custom user-defined styles.
Styles promote consistency across a workbook and make it easier to apply and modify formatting.
Font
Specifies the font settings for cells using this style.
Declaration
public virtual AbstractFont Font { get; set; }
Property Value
| Type | Description |
|---|---|
| AbstractFont |
Remarks
A CellStyle encapsulates formatting properties including alignment, borders, fill, and font.
Styles can be built-in (like "Normal", "Heading 1") or custom user-defined styles.
Styles promote consistency across a workbook and make it easier to apply and modify formatting.
Format
Specifies the number format for cells using this style.
Declaration
public virtual Format Format { get; set; }
Property Value
| Type | Description |
|---|---|
| Format |
Remarks
A CellStyle encapsulates formatting properties including alignment, borders, fill, and font.
Styles can be built-in (like "Normal", "Heading 1") or custom user-defined styles.
Styles promote consistency across a workbook and make it easier to apply and modify formatting.
IsBuiltIn
Indicates whether the built in condition is true for the CellStyle.
Declaration
public bool IsBuiltIn { get; }
Property Value
| Type | Description |
|---|---|
| bool | The is built in returned by the operation. |
Remarks
A CellStyle encapsulates formatting properties including alignment, borders, fill, and font.
Styles can be built-in (like "Normal", "Heading 1") or custom user-defined styles.
Styles promote consistency across a workbook and make it easier to apply and modify formatting.
Name
Exposes the name associated with CellStyle.
Declaration
public string Name { get; set; }
Property Value
| Type | Description |
|---|---|
| string | The name returned by the operation. |
Remarks
A CellStyle encapsulates formatting properties including alignment, borders, fill, and font.
Styles can be built-in (like "Normal", "Heading 1") or custom user-defined styles.
Styles promote consistency across a workbook and make it easier to apply and modify formatting.