Add more changes to table API and documentation

This commit is contained in:
Dolan Miu
2018-12-31 01:55:15 +00:00
parent ab07f2ecbe
commit b9465b2a20
5 changed files with 36 additions and 15 deletions

View File

@ -40,14 +40,6 @@ const cell = table.getCell([ROW INDEX], [COLUMN INDEX]);
const cell = table.getCell(0, 2);
```
### Cell Properties & Styling
With the cell's `Properties`, you csn change it's borders, set it's vertical alignment
```ts
cell.Properties;
```
## Borders
BorderStyle can be imported from `docx`. Size determines the thickness. HTML color can be a hex code or alias such as `red`.
@ -80,16 +72,32 @@ cell.Borders.addStartBorder(BorderStyle.DOT_DOT_DASH, 3, "#ff8000");
## Set Width
```ts
table.setWidth([WIDTH], [OPTIONAL WidthType]);
import { WidthType } from "docx";
table.setWidth([WIDTH], [OPTIONAL WidthType. Defaults to DXA]);
```
For example:
```ts
table.setWidth(4535, WidthType.DXA);
```
## Vertical Align
## Borders
Sets the vertical alignment of the contents of the cell
```ts
import { VerticalAlign } from "docx";
cell.setVerticalAlign([VerticalAlign TYPE]);
```
For example, to center align a cell:
```ts
cell.setVerticalAlign(VerticalAlign.CENTER);
```
## Rows