support style changes in revisions

This commit is contained in:
Thomas Jansen
2021-11-26 12:29:11 +01:00
parent 09b81017d0
commit e598faad28
4 changed files with 110 additions and 5 deletions

View File

@ -53,9 +53,21 @@ In addition to marking text as inserted or deleted, change tracking can also be
```ts
import { Document } from "docx";
const doc = new Document({
features: {
trackRevisions: true,
},
});
const doc = new Document({});
doc.Settings.addTrackRevisions()
```
If you want to express a style changes, you can add a `revision` to a `TextRun` which need to include all previous style attributes.
```ts
new TextRun({
bold: true,
text: "This text is now bold and was previously not",
revision: {
id: 1,
author: "Firstname Lastname",
date: "2020-10-06T09:05:00Z",
bold: false,
}
}).break()
````