deno.land / x / docx@8.5.0 / demo / 54-custom-properties.ts

54-custom-properties.ts
نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Custom Properties// Custom properties are incredibly useful if you want to be able to apply quick parts or custom cover pages// to the document in Word after the document has been generated. Standard properties (such as creator, title// and subject) cover typical use cases, but sometimes custom properties are required.
import * as fs from "fs";import { Document, Packer } from "docx";
const doc = new Document( // Standard properties { creator: "Creator", title: "Title", subject: "Subject", description: "Description", customProperties: [ { name: "Subtitle", value: "Subtitle" }, { name: "Address", value: "Address" }, ], sections: [], },);
Packer.toBuffer(doc).then((buffer) => { fs.writeFileSync("My Document.docx", buffer);});
docx

Version Info

Tagged at
4 months ago