Paragraph documentation

This commit is contained in:
Dolan
2019-08-05 23:24:43 +01:00
parent c2c05b0140
commit cb699e17b3

View File

@ -56,27 +56,27 @@ doc.addSection({
This is the list of options for a paragraph. A detailed explanation is below: This is the list of options for a paragraph. A detailed explanation is below:
| Property | Type | Mandatory? | Possible Values | | Property | Type | Mandatory? | Possible Values |
| ------------------- | ------------------------------------------------------------------------------------------------------------------- | ---------- | ---------------------------------------------------------------------------------------------------------- | | ----------------------------- | ------------------------------------------------------------------------------------------------------------------- | ---------- | ---------------------------------------------------------------------------------------------------------- |
| [text](#text) | `string` | Optional | | | [text](#text) | `string` | Optional | |
| [heading](#heading) | `HeadingLevel` | Optional | `HEADING_1`, `HEADING_2`, `HEADING_3`, `HEADING_4`, `HEADING_5`, `HEADING_6`, `TITLE` | | [heading](#heading) | `HeadingLevel` | Optional | `HEADING_1`, `HEADING_2`, `HEADING_3`, `HEADING_4`, `HEADING_5`, `HEADING_6`, `TITLE` |
| [border](#border) | `IBorderOptions` | Optional | `top`, `bottom`, `left`, `right`. Each of these are of type IBorderPropertyOptions. Click here for Example | | [border](#border) | `IBorderOptions` | Optional | `top`, `bottom`, `left`, `right`. Each of these are of type IBorderPropertyOptions. Click here for Example |
| [spacing](#spacing) | `ISpacingProperties` | Optional | See below for ISpacingProperties | | [spacing](#spacing) | `ISpacingProperties` | Optional | See below for ISpacingProperties |
| outlineLevel | `number` | Optional | | | [outlineLevel](#outline-level) | `number` | Optional | |
| alignment | `AlignmentType` | Optional | | | alignment | `AlignmentType` | Optional | |
| heading | `HeadingLevel` | Optional | | | heading | `HeadingLevel` | Optional | |
| bidirectional | `boolean` | Optional | | | bidirectional | `boolean` | Optional | |
| thematicBreak | `boolean` | Optional | | | thematicBreak | `boolean` | Optional | |
| pageBreakBefore | `boolean` | Optional | | | pageBreakBefore | `boolean` | Optional | |
| contextualSpacing | `boolean` | Optional | | | contextualSpacing | `boolean` | Optional | |
| indent | `IIndentAttributesProperties` | Optional | | | indent | `IIndentAttributesProperties` | Optional | |
| keepLines | `boolean` | Optional | | | keepLines | `boolean` | Optional | |
| keepNext | `boolean` | Optional | | | keepNext | `boolean` | Optional | |
| children | `(TextRun or PictureRun or Hyperlink)[]` | Optional | | | children | `(TextRun or PictureRun or Hyperlink)[]` | Optional | |
| style | `string` | Optional | | | style | `string` | Optional | |
| tabStop | `{ left?: ITabStopOptions; right?: ITabStopOptions; maxRight?: { leader: LeaderType; }; center?: ITabStopOptions }` | Optional | | | tabStop | `{ left?: ITabStopOptions; right?: ITabStopOptions; maxRight?: { leader: LeaderType; }; center?: ITabStopOptions }` | Optional | |
| bullet | `{ level: number }` | Optional | | | bullet | `{ level: number }` | Optional | |
| numbering | `{ num: Num; level: number; custom?: boolean }` | Optional | | | numbering | `{ num: Num; level: number; custom?: boolean }` | Optional | |
## Text ## Text
@ -161,13 +161,17 @@ Add spacing before the paragraph:
```ts ```ts
const paragraph = new Paragraph({ const paragraph = new Paragraph({
text: "line with contextual spacing", text: "Paragraph with spacing before",
spacing: { spacing: {
before: 200, before: 200,
}, },
}); });
``` ```
## Outline Level
**Example:**
## Styles ## Styles
To create styles, please refer to the styling Wiki: https://github.com/dolanmiu/docx/wiki/Styling To create styles, please refer to the styling Wiki: https://github.com/dolanmiu/docx/wiki/Styling