CellStyle Interface
Resolved whole-cell formatting. Color nulls choose automatic colors and sizes use points.
Package: @txtextcontrol/tx-sheet-control. Version: 2.0.0.
Type-only declaration; it is not a JavaScript runtime constructor.
Members
Properties
| Property | Description |
|---|---|
| bold | The bold value of CellStyle. |
| borderEdges | The borderEdges value of CellStyle. |
| borders | The borders value of CellStyle. |
| currencyCode | The currencyCode value of CellStyle. |
| decimalPlaces | The decimalPlaces value of CellStyle. |
| fillColor | The fillColor value of CellStyle. |
| fontFamily | The fontFamily value of CellStyle. |
| fontSize | The fontSize value of CellStyle. |
| format | The format value of CellStyle. |
| hiddenFormula | The hiddenFormula value of CellStyle. |
| horizontalAlign | The horizontalAlign value of CellStyle. |
| indent | The indent value of CellStyle. |
| italic | The italic value of CellStyle. |
| locked | The locked value of CellStyle. |
| numberFormatCode | Native Excel format code, up to 255 characters; null uses category defaults. |
| numberLocale | BCP 47 display locale; null uses the workbook's number locale. |
| shrinkToFit | The shrinkToFit value of CellStyle. |
| strikethrough | The strikethrough value of CellStyle. |
| textColor | The textColor value of CellStyle. |
| textRotation | The textRotation value of CellStyle. |
| underline | The underline value of CellStyle. |
| verticalAlign | The verticalAlign value of CellStyle. |
| verticalText | The verticalText value of CellStyle. |
| wrapText | The wrapText value of CellStyle. |
| fillPattern | Hatch foreground over the cell background. |
Examples
Use a fresh workbook. Create and format the sample data, apply this API and retain the returned document or result in your application. In the browser pass editor.workbook; in Node.js pass the server control.
import type { Workbook } from '@txtextcontrol/tx-sheet-control';
import type { CellStyle } from '@txtextcontrol/tx-sheet-control';
function createCellStyleReport(book: Workbook, settings: CellStyle) {
const sheet = book.sheets.at(0);
sheet.cell('A1').setText('October invoice');
sheet
.cell('A1')
.format({
fontFamily: 'Liberation Sans',
fontSize: 16,
bold: true,
textColor: '#ffffff',
fillColor: '#163b63',
});
sheet.columns.at(0).setWidth({ pixels: 240 });
sheet.range('B8:B9').setValues([[120], [80]]);
sheet.cell('B10').setFormula('=SUM(B8:B9)');
sheet.range('B8:B10').format({ numberFormatCode: '#,##0.00', fontSize: 11 });
sheet.cell('A1').format({ ...settings });
return sheet;
}