This commit is contained in:
Dolan
2019-10-10 01:18:20 +01:00
parent 721de30587
commit b571a7550f

View File

@ -1,28 +1,44 @@
// Sequential Captions // Sequential Captions
// 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, Packer, Paragraph, TextRun } from "../build"; import { Document, Packer, Paragraph, SequentialIdentifier, TextRun } from "../build";
const doc = new Document(); const doc = new Document();
doc.addSection({ doc.addSection({
children: [ children: [
new Paragraph("Hello World 1->") new Paragraph({
.addSequentialIdentifier("Caption") children: [
.addRun(new TextRun(" text after sequencial caption 2->")) new TextRun("Hello World 1->"),
.addSequentialIdentifier("Caption"), new SequentialIdentifier("Caption"),
new Paragraph("Hello World 1->") new TextRun(" text after sequencial caption 2->"),
.addSequentialIdentifier("Label") new SequentialIdentifier("Caption"),
.addRun(new TextRun(" text after sequencial caption 2->")) ],
.addSequentialIdentifier("Label"), }),
new Paragraph("Hello World 1->") new Paragraph({
.addSequentialIdentifier("Another") children: [
.addRun(new TextRun(" text after sequencial caption 3->")) new TextRun("Hello World 1->"),
.addSequentialIdentifier("Label"), new SequentialIdentifier("Label"),
new Paragraph("Hello World 2->") new TextRun(" text after sequencial caption 2->"),
.addSequentialIdentifier("Another") new SequentialIdentifier("Label"),
.addRun(new TextRun(" text after sequencial caption 4->")) ],
.addSequentialIdentifier("Label"), }),
new Paragraph({
children: [
new TextRun("Hello World 1->"),
new SequentialIdentifier("Another"),
new TextRun(" text after sequencial caption 3->"),
new SequentialIdentifier("Label"),
],
}),
new Paragraph({
children: [
new TextRun("Hello World 2->"),
new SequentialIdentifier("Another"),
new TextRun(" text after sequencial caption 4->"),
new SequentialIdentifier("Label"),
],
}),
], ],
}); });