Merge pull request #1785 from dolanmiu/feat/exact

#1773 Add `exact` for spacing
This commit is contained in:
Dolan
2022-11-19 16:24:07 +00:00
committed by GitHub
2 changed files with 10 additions and 7 deletions

View File

@ -76,7 +76,7 @@ This is the list of options for a paragraph. A detailed explanation is below:
| indent | `IIndentAttributesProperties` | Optional | | | indent | `IIndentAttributesProperties` | Optional | |
| keepLines | `boolean` | Optional | | | keepLines | `boolean` | Optional | |
| keepNext | `boolean` | Optional | | | keepNext | `boolean` | Optional | |
| children | `(TextRun or ImageRun or Hyperlink)[]` | Optional | | | children | `(TextRun or ImageRun or Hyperlink)[]` | Optional | |
| style | `string` | Optional | | | style | `string` | Optional | |
| [tabStop](usage/tab-stops) | `{ left?: ITabStopOptions; right?: ITabStopOptions; maxRight?: { leader: LeaderType; }; center?: ITabStopOptions }` | Optional | | | [tabStop](usage/tab-stops) | `{ left?: ITabStopOptions; right?: ITabStopOptions; maxRight?: { leader: LeaderType; }; center?: ITabStopOptions }` | Optional | |
| [bullet](usage/bullet-points) | `{ level: number }` | Optional | | | [bullet](usage/bullet-points) | `{ level: number }` | Optional | |
@ -180,12 +180,14 @@ Adding spacing between paragraphs
### ISpacingProperties ### ISpacingProperties
| Property | Type | Notes | Possible Values | | Property | Type | Notes | Possible Values |
| -------- | -------------- | -------- | ----------------------------- | | -------- | -------------- | -------- | -------------------------------------- |
| after | `number` | Optional | | | after | `number` | Optional | |
| before | `number` | Optional | | | before | `number` | Optional | |
| line | `number` | Optional | | | line | `number` | Optional | |
| lineRule | `LineRuleType` | Optional | `AT_LEAST`, `EXACTLY`, `AUTO` | | lineRule | `LineRuleType` | Optional | `AT_LEAST`, `EXACTLY`, `EXACT`, `AUTO` |
Note: The `lineRule` property has different values depending on the version of Word you are using. The `EXACTLY` value is only available in Word 2016 and above. Use `EXACT` for greater support, including LibreOffice etc. Read this issue for more information: https://github.com/dolanmiu/docx/issues/1773.
**Example:** **Example:**

View File

@ -4,6 +4,7 @@ import { XmlAttributeComponent, XmlComponent } from "@file/xml-components";
export enum LineRuleType { export enum LineRuleType {
AT_LEAST = "atLeast", AT_LEAST = "atLeast",
EXACTLY = "exactly", EXACTLY = "exactly",
EXACT = "exact",
AUTO = "auto", AUTO = "auto",
} }
export interface ISpacingProperties { export interface ISpacingProperties {