Class XlsxCellStyle
- Namespace
- DocWright.Spreadsheet
- Assembly
- DocWright.Spreadsheet.dll
Everything about how one cell looks: its font, its fill, its edges, its alignment and the number format its value is displayed through.
public sealed class XlsxCellStyle : IEquatable<XlsxCellStyle>
- Inheritance
-
XlsxCellStyle
- Implements
- Inherited Members
Remarks
A style is a value, not a resource. Two cells given equal styles share one record in the workbook's style table, which the writer deduplicates on the way out — so a caller builds one of these per cell without thinking about it and the file still carries each distinct combination once.
Equality is what makes that work, so every member takes part in it and the type is immutable. With(string?, decimal?, bool?, bool?, bool?, bool?, ColorRgb?, ColorRgb?, string?, XlsxHorizontalAlignment?, XlsxVerticalAlignment?, bool?, XlsxBorder?, XlsxBorder?, XlsxBorder?, XlsxBorder?) produces a modified copy.
Fields
- Default
The style a cell has when it is given none: Excel's defaults throughout.
- MaxIndent
The deepest indent a cell may have, in levels: Excel's own limit.
Properties
- BackgroundColor
Gets the cell's fill colour, or null for no fill.
- Bold
Gets whether the font is bold.
- BottomBorder
Gets the bottom edge.
- FontColor
Gets the text colour, or null for Excel's default.
- FontFamily
Gets the font family. Never null or empty.
- FontSizePoints
Gets the font size in points.
- Hidden
Gets whether the cell's formula is hidden: on a protected sheet Excel shows its value and not its formula. False by default.
- HorizontalAlignment
Gets the horizontal alignment.
- Indent
Gets the indent from the edge the content is aligned to, in levels of about three characters of the workbook's default font; 0 for none.
- Italic
Gets whether the font is italic.
- LeftBorder
Gets the left edge.
- Locked
Gets whether the cell is locked: on a protected sheet Excel lets no one change it (Phase 215). True by default, as in Excel; a lock means nothing until the sheet is protected.
- NumberFormat
Gets the number format code, or null for the general format.
- RightBorder
Gets the right edge.
- ShrinkToFit
Gets whether the content is drawn in a smaller size when it is too wide for the cell, so that it fits on one line. It has no effect on a cell whose text wraps.
- Strike
Gets whether the text is struck through.
- TextRotation
Gets the text's rotation in Excel's
textRotationterms: 0 upright, 1 to 90 degrees counter-clockwise, 91 to 180 that many degrees less 90 clockwise (180 is a quarter turn clockwise).
- TopBorder
Gets the top edge.
- Underline
Gets whether the text is underlined.
- VerticalAlignment
Gets the vertical alignment.
- WrapText
Gets whether text wraps inside the cell.
Methods
- With(string?, decimal?, bool?, bool?, bool?, bool?, ColorRgb?, ColorRgb?, string?, XlsxHorizontalAlignment?, XlsxVerticalAlignment?, bool?, XlsxBorder?, XlsxBorder?, XlsxBorder?, XlsxBorder?)
Returns a copy with the members named by the arguments replaced.
- WithHidden(bool)
Returns a copy whose formula is hidden or not (Hidden).
- WithIndent(int)
Returns a copy with the content indented.
- WithLocked(bool)
Returns a copy that is locked or not (Locked).
- WithShrinkToFit(bool)
Returns a copy whose content does or does not shrink to fit.
- WithTextRotation(int)
Returns a copy with the text turned.