Deploy dolanmiu/docx to github.com/dolanmiu/docx.git:gh-pages

This commit is contained in:
Deployment Bot (from Travis CI)
2021-06-01 00:16:45 +00:00
parent 812e8111db
commit 1a00270fa8
309 changed files with 6827 additions and 16546 deletions

View File

@ -37,7 +37,7 @@ const paragraph = new Paragraph({
new TextRun("This is a simple demo"),
new DeletedTextRun({
text: "with a deletion.",
color: "red",
color: "ff0000",
bold: true,
size: 24,
id: 0,

View File

@ -12,14 +12,29 @@ The complete documentation can be found [here](https://www.ecma-international.or
All you need to do is create a `TableOfContents` object and assign it to the document.
```ts
const toc = new TableOfContents("Summary", {
hyperlink: true,
headingStyleRange: "1-5",
stylesWithLevels: [new StyleLevel("MySpectacularStyle", 1)],
});
**Note**: updateFields feature must be enabled for TableOfContents to update correctly.
doc.addTableOfContents(toc);
```ts
const doc = new Document({
features: {
updateFields: true,
},
sections: [
{
children: [
new TableOfContents("Summary", {
hyperlink: true,
headingStyleRange: "1-5",
}),
new Paragraph({
text: "Header #1",
heading: HeadingLevel.HEADING_1,
pageBreakBefore: true,
}),
]
}
]
});
```
## Table of Contents Options

View File

@ -53,6 +53,18 @@ const table = new Table({
});
```
### Set Indent
```ts
const table = new Table({
...,
indent: {
size: 600,
type: WidthType.DXA,
}
});
```
## Table Row
A table consists of multiple `table rows`. Table rows have a list of `children` which accepts a list of `table cells` explained below. You can create a simple `table row` like so:
@ -145,7 +157,7 @@ const tableRow = new TableRow({
| Property | Type | Notes |
| ------------- | ----------------------------------- | ----------------------------------------------------------- |
| children | `Array<Paragraph or Table>` | Required. You can nest tables by adding a table into a cell |
| shading | `ITableShadingAttributesProperties` | Optional |
| shading | `IShadingAttributesProperties` | Optional |
| margins | `ITableCellMarginOptions` | Optional |
| verticalAlign | `VerticalAlign` | Optional |
| columnSpan | `number` | Optional |
@ -171,7 +183,7 @@ const cell = new TableCell({
top: {
style: BorderStyle.DASH_DOT_STROKED,
size: 1,
color: "red",
color: "ff0000",
},
bottom: {
style: BorderStyle.THICK_THIN_MEDIUM_GAP,
@ -190,12 +202,12 @@ Google DOCS does not support start and end borders, instead they use left and ri
const cell = new TableCell({
...,
borders: {
top: {
left: {
style: BorderStyle.DOT_DOT_DASH,
size: 3,
color: "green",
color: "00FF00",
},
bottom: {
right: {
style: BorderStyle.DOT_DOT_DASH,
size: 3,
color: "ff8000",