:doc: update demo 53-chinese.ts

This commit is contained in:
wangfengming
2020-06-07 14:58:59 +08:00
parent f11bca728f
commit d6fa33035a

View File

@ -7,7 +7,7 @@
// Import from 'docx' rather than '../build' if you install from npm // Import from 'docx' rather than '../build' if you install from npm
import * as fs from "fs"; import * as fs from "fs";
import { Document, HeadingLevel, Packer, Paragraph } from "../build"; import { Document, HeadingLevel, Packer, Paragraph, TextRun } from "../build";
const doc = new Document({ const doc = new Document({
styles: { styles: {
@ -38,6 +38,15 @@ doc.addSection({
new Paragraph({ new Paragraph({
text: "中文和英文 Chinese and English", text: "中文和英文 Chinese and English",
}), }),
new Paragraph({
children: [
new TextRun({
text: "中文和英文 Chinese and English",
font: { eastAsia: "SimSun" }, // set eastAsia to "SimSun".
// The ascii characters will use the default font ("Times") specified in paragraphStyles
}),
],
}),
], ],
}); });