Skip to content

Commit

Permalink
Merge pull request #1785 from dolanmiu/feat/exact
Browse files Browse the repository at this point in the history
#1773 Add `exact` for spacing
  • Loading branch information
dolanmiu authored Nov 19, 2022
2 parents 64b604c + 251eafe commit ff8a2ed
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
16 changes: 9 additions & 7 deletions docs/usage/paragraph.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ This is the list of options for a paragraph. A detailed explanation is below:
| indent | `IIndentAttributesProperties` | Optional | |
| keepLines | `boolean` | Optional | |
| keepNext | `boolean` | Optional | |
| children | `(TextRun or ImageRun or Hyperlink)[]` | Optional | |
| children | `(TextRun or ImageRun or Hyperlink)[]` | Optional | |
| style | `string` | Optional | |
| [tabStop](usage/tab-stops) | `{ left?: ITabStopOptions; right?: ITabStopOptions; maxRight?: { leader: LeaderType; }; center?: ITabStopOptions }` | Optional | |
| [bullet](usage/bullet-points) | `{ level: number }` | Optional | |
Expand Down Expand Up @@ -180,12 +180,14 @@ Adding spacing between paragraphs

### ISpacingProperties

| Property | Type | Notes | Possible Values |
| -------- | -------------- | -------- | ----------------------------- |
| after | `number` | Optional | |
| before | `number` | Optional | |
| line | `number` | Optional | |
| lineRule | `LineRuleType` | Optional | `AT_LEAST`, `EXACTLY`, `AUTO` |
| Property | Type | Notes | Possible Values |
| -------- | -------------- | -------- | -------------------------------------- |
| after | `number` | Optional | |
| before | `number` | Optional | |
| line | `number` | Optional | |
| 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:**

Expand Down
1 change: 1 addition & 0 deletions src/file/paragraph/formatting/spacing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { XmlAttributeComponent, XmlComponent } from "@file/xml-components";
export enum LineRuleType {
AT_LEAST = "atLeast",
EXACTLY = "exactly",
EXACT = "exact",
AUTO = "auto",
}
export interface ISpacingProperties {
Expand Down

0 comments on commit ff8a2ed

Please sign in to comment.