Update documentation

This commit is contained in:
Dolan Miu
2023-03-26 04:05:41 +01:00
parent 2d17954104
commit ec379f2e4d
2 changed files with 15 additions and 1 deletions

View File

@ -305,4 +305,12 @@ Example: https://github.com/dolanmiu/docx/blob/master/demo/15-page-break-before.
## Page break control
Paragraphs have `.keepLines()` and `.keepNext()` methods that allow restricting page breaks within and between paragraphs. See [this Microsoft article](https://support.office.com/en-us/article/Keep-lines-and-paragraphs-together-d72af534-926f-4c4b-830a-abfc2daa3bfa) for more details)
Paragraphs have `keepLines` and `keepNext` properties that allow restricting page breaks within and between paragraphs. See [this Microsoft article](https://support.office.com/en-us/article/Keep-lines-and-paragraphs-together-d72af534-926f-4c4b-830a-abfc2daa3bfa) for more details.
```ts
const paragraph = new Paragraph({
text: "Stay on the same page",
keepLines: true,
keepNext: true,
});
```

View File

@ -23,7 +23,13 @@ export interface ILevelParagraphStylePropertiesOptions {
readonly leftTabStop?: number;
readonly indent?: IIndentAttributesProperties;
readonly spacing?: ISpacingProperties;
/**
* Specifies that the paragraph (or at least part of it) should be rendered on the same page as the next paragraph when possible. If multiple paragraphs are to be kept together but they exceed a page, then the set of paragraphs begin on a new page and page breaks are used thereafter as needed.
*/
readonly keepNext?: boolean;
/**
* Specifies that all lines of the paragraph are to be kept on a single page when possible.
*/
readonly keepLines?: boolean;
readonly outlineLevel?: number;
}