Skip to content

Commit

Permalink
docs: better documentation for cell / header styling
Browse files Browse the repository at this point in the history
  • Loading branch information
ChronicStone committed Apr 29, 2024
1 parent 9efb6b4 commit ed259ac
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
Binary file modified bun.lockb
Binary file not shown.
25 changes: 18 additions & 7 deletions docs/schema-builder/columns.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ ExcelSchemaBuilder.create<{ date: Date, amount: number, currency: 'EUR' | 'USD'
![Column formats](/images/examples/col-format-1.png)

## `cellStyle`
- **Description:** Define the style for the cell, either as a static `CellStyle` object or a function for dynamic styling.
- **Type:** `CellStyle | ((data: T) => CellStyle)`
- **Description:** Define the style for the cell, either as a static `CellStyle` object or a function for dynamic styling. See [xlsx-js-style](https://github.com/gitbrent/xlsx-js-style?tab=readme-ov-file#cell-style-properties) for more information on `CellStyle`.
- **Type:** `CellStyle | ((data: T, rowIndex: number, subRowIndex: number) => CellStyle)`
- **Required:** No
- **Example:**

Expand All @@ -121,11 +121,22 @@ ExcelSchemaBuilder.create<{ status: string }>()
})
```

rray<{
value: (data: T[]) => BaseCellValue
format?: string | ((data: T[]) => string)
cellStyle?: CellStyle | ((data: T[]) => CellStyle)
}>
## `headerStyle`
- **Description:** Define the style for the header cell of the column. See [xlsx-js-style](https://github.com/gitbrent/xlsx-js-style?tab=readme-ov-file#cell-style-properties) for more information on `CellStyle`.
- **Type:** `CellStyle`
- **Required:** No
- **Example:**

```ts twoslash
import { ExcelSchemaBuilder } from '@chronicstone/typed-xlsx'
// ---cut-before---

ExcelSchemaBuilder.create<{ status: string }>()
.column('Status', {
key: 'status',
headerStyle: { fill: { fgColor: { rgb: 'FFFF00' } } }
})
```

## `summary`
- **Description:** Summaries provide aggregate information at the end of the table.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"@antfu/eslint-config": "^2.1.2",
"@antfu/ni": "^0.21.12",
"@antfu/utils": "^0.7.6",
"@chronicstone/typed-xlsx": "0.2.10",
"@chronicstone/typed-xlsx": "0.2.13",
"@faker-js/faker": "^8.3.1",
"@shikijs/vitepress-twoslash": "^1.3.0",
"@types/node": "^20.12.7",
Expand Down

0 comments on commit ed259ac

Please sign in to comment.