Added differentFirstPageHeader section property
This commit is contained in:
@ -1,15 +1,15 @@
|
||||
const docx = require('../build');
|
||||
|
||||
var doc = new docx.Document();
|
||||
var doc = new docx.Document(undefined,{differentFirstPageHeader:true});
|
||||
|
||||
doc.createParagraph("First Page").pageBreak()
|
||||
doc.createParagraph("Second Page");
|
||||
|
||||
|
||||
var pageoneheader = new docx.Paragraph("Running head: My Title").maxRightTabStop();
|
||||
var tab = new docx.TextRun().tab()
|
||||
var pageNumber = new docx.TextRun().pageNumber()
|
||||
|
||||
var pageoneheader = new docx.Paragraph("Running head: My Title").maxRightTabStop();
|
||||
|
||||
pageoneheader.addRun(tab);
|
||||
pageoneheader.addRun(pageNumber);
|
||||
doc.firstPageHeader.addParagraph(pageoneheader);
|
||||
|
@ -68,14 +68,10 @@ export class Compiler {
|
||||
name: "word/header1.xml",
|
||||
});
|
||||
|
||||
|
||||
|
||||
this.archive.append(xmlHeader2, {
|
||||
name: "word/header2.xml",
|
||||
});
|
||||
|
||||
|
||||
|
||||
this.archive.append(xmlFooter, {
|
||||
name: "word/footer1.xml",
|
||||
});
|
||||
|
@ -31,6 +31,7 @@ export class SectionProperties extends XmlComponent {
|
||||
space: 708,
|
||||
linePitch: 360,
|
||||
orientation: "portrait",
|
||||
differentFirstPageHeader: false,
|
||||
};
|
||||
|
||||
const mergedOptions = {
|
||||
@ -53,8 +54,12 @@ export class SectionProperties extends XmlComponent {
|
||||
this.root.push(new Columns(mergedOptions.space));
|
||||
this.root.push(new DocumentGrid(mergedOptions.linePitch));
|
||||
this.root.push(new HeaderReference("default",3));
|
||||
this.root.push(new HeaderReference("first",5));
|
||||
this.root.push(new TitlePage());
|
||||
|
||||
if (mergedOptions.differentFirstPageHeader) {
|
||||
this.root.push(new HeaderReference("first",5));
|
||||
this.root.push(new TitlePage());
|
||||
}
|
||||
|
||||
this.root.push(new FooterReference());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user