HorizontalAlignmentStyle Enum
Represents available horizontal alignment options used in Horizontal
Remarks
Conceptually, cell formatting is divided into following groups:
- Number - indicates how to format and render the numeric value of a cell. Associated property is Number
Format . - Alignment - formatting information pertaining to text alignment in cells. Associated properties are Horizontal
Alignment , VerticalAlignment , Indent, Rotation, IsText , WrapVertical Text and ShrinkTo .Fit - Font - defines the properties for the used font. Associated property is Font.
- Border - expresses a single set of cell border formats (left, right, top, bottom and diagonal). Associated property is Borders.
- Fill - specifies fill formatting (pattern or gradient). Associated property is Fill
Pattern . - Protection - contains protection properties associated with the cell. Associated properties are Locked and Formula
Hidden .
Additional Cell
- Name - name of the referenced Style.
- Quote
Prefix - true to store numeric value of a cell as text; otherwise, false. - Is
Default - true if Name Style is default (Normal) and there are no additional modifications of cell formatting; otherwise, false.
Excel
Excel
Style can either be built-in or user-defined. Built-in style is accessible from Styles via Built
Cell formatting group (Number, Alignment, Font, Border, Fill or Protection) (and its associated properties) is resolved from Name Style, unless cell formatting group or its associated property is modified.
Cell formatting is available for one or more cells through Style property which is available on Excel
note
For performance reasons, cell formatting on Cell
Setting cell formatting property on Cell
To set Style to one or more cells, simply assign it to Style property.
tip
Preferable way to modify formatting property of multiple cells is to get Cell
If modifying multiple formatting properties of a Cell
GemBox.Spreadsheet internally takes care not to allocate unnecessary cells when formatting a range of cells (for example, when formatting Cells) and to cache formatting information of equally formatted cells, at the appropriate time, to reduce memory footprint.
Fields
Center | The horizontal alignment is centered, meaning the text is centered across the cell. |
CenterAcross | The horizontal alignment is centered across multiple cells. This option is currently not supported in PDF, XPS, and image formats and defaults to Center. |
Distributed | Indicates that each 'word' in each line of text inside the cell is evenly distributed across the width of the cell, with flush right and left margins. When there is also an Indent value to apply, both the left and right side of the cell are padded by the indent value. A 'word' is a set of characters with no space character in them. Two lines inside a cell are separated by a carriage return. |
Fill | Indicates that the value of the cell should be filled across the entire width of the cell. This option is currently not supported in PDF, XPS, and image formats and defaults to General. |
General | The horizontal alignment is general-aligned. Text data is left-aligned. Numbers, dates, and times are right-aligned. Boolean types are centered. Changing the alignment does not change the type of data. |
Justify | The horizontal alignment is justified (flush left and right). For each line of text, aligns each line of the wrapped text in a cell to the right and left (except the last line). If no single line of text wraps in the cell, then the text is not justified. |
Left | The horizontal alignment is left-aligned. Aligns contents at the left edge of the cell. If an Indent amount is specified, the contents of the cell is indented from the left by the specified number of character spaces. The character spaces are based on the default font and font size for the workbook (Normal style). |
Right | The horizontal alignment is right-aligned, meaning that cell contents are aligned at the right edge of the cell. |