Fix: separate vertical alignment enums for ITableCellOptions and ISectionPropertiesOptions (#3079)

* fix: separate vertical alignment enums for table and section properties

- Introduced `VerticalAlignTable` for table-cell vertical alignment with valid values: `top`, `center`, and `bottom`.
- Added `VerticalAlignSection` for section properties, extending `VerticalAlignTable` with an additional value `both`.
- Marked the original `VerticalAlign` as deprecated for backward compatibility, directing users to the new enums.
- Updated type definitions for better clarity on valid vertical alignments.

* refactor: update vertical alignment imports and types for section and table properties

- Renamed `VerticalAlign` to `VerticalAlignSection` in section properties and `VerticalAlignTable` in table-cell properties for clarity.
- Updated type definitions to reflect the new enum names, ensuring better organization and understanding of vertical alignment options.
- Adjusted related test cases to utilize the new imports and types.

* refactor: update demos to use new enums for table and section properties for vertical alignment
This commit is contained in:
Firat Ciftci
2025-05-02 13:58:10 -05:00
committed by GitHub
parent 1e6c9e1772
commit 7d1129900f
14 changed files with 81 additions and 52 deletions

View File

@ -159,7 +159,7 @@ const tableRow = new TableRow({
| children | `Array<Paragraph or Table>` | Required. You can nest tables by adding a table into a cell |
| shading | `IShadingAttributesProperties` | Optional |
| margins | `ITableCellMarginOptions` | Optional |
| verticalAlign | `VerticalAlign` | Optional |
| verticalAlign | `VerticalAlignTable` | Optional |
| columnSpan | `number` | Optional |
| rowSpan | `number` | Optional |
| borders | `BorderOptions` | Optional |
@ -266,7 +266,7 @@ Sets the vertical alignment of the contents of the cell
```ts
const cell = new TableCell({
...,
verticalAlign: VerticalAlign,
verticalAlign: VerticalAlignTable,
});
```
@ -282,7 +282,7 @@ For example, to center align a cell:
```ts
const cell = new TableCell({
verticalAlign: VerticalAlign.CENTER,
verticalAlign: VerticalAlignTable.CENTER,
});
```