Remove old implementation of first page header
This commit is contained in:
@ -33,7 +33,6 @@ export class Compiler {
|
||||
const xmlNumbering = xml(this.formatter.format(this.file.Numbering));
|
||||
const xmlRelationships = xml(this.formatter.format(this.file.DocumentRelationships));
|
||||
const xmlFileRelationships = xml(this.formatter.format(this.file.FileRelationships));
|
||||
const xmlHeader2 = xml(this.formatter.format(this.file.firstPageHeader.Header));
|
||||
const xmlContentTypes = xml(this.formatter.format(this.file.ContentTypes));
|
||||
const xmlAppProperties = xml(this.formatter.format(this.file.AppProperties));
|
||||
|
||||
@ -57,10 +56,6 @@ export class Compiler {
|
||||
name: "word/numbering.xml",
|
||||
});
|
||||
|
||||
this.archive.append(xmlHeader2, {
|
||||
name: "word/header2.xml",
|
||||
});
|
||||
|
||||
// headers
|
||||
for (let i = 0; i < this.file.Headers.length; i++) {
|
||||
const element = this.file.Headers[i];
|
||||
|
@ -25,7 +25,6 @@ export class ContentTypes extends XmlComponent {
|
||||
new Override("application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml", "/word/document.xml"),
|
||||
);
|
||||
|
||||
this.root.push(new Override("application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml", "/word/header2.xml"));
|
||||
this.root.push(new Override("application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml", "/word/styles.xml"));
|
||||
this.root.push(new Override("application/vnd.openxmlformats-package.core-properties+xml", "/docProps/core.xml"));
|
||||
this.root.push(new Override("application/vnd.openxmlformats-officedocument.extended-properties+xml", "/docProps/app.xml"));
|
||||
|
@ -12,7 +12,7 @@ import { PageMargin } from "./page-margin/page-margin";
|
||||
import { IPageMarginAttributes } from "./page-margin/page-margin-attributes";
|
||||
import { PageSize } from "./page-size/page-size";
|
||||
import { IPageSizeAttributes, PageOrientation } from "./page-size/page-size-attributes";
|
||||
import { TitlePage } from "./title-page/title-page";
|
||||
// import { TitlePage } from "./title-page/title-page";
|
||||
|
||||
export type SectionPropertiesOptions = IPageSizeAttributes &
|
||||
IPageMarginAttributes &
|
||||
@ -69,15 +69,16 @@ export class SectionProperties extends XmlComponent {
|
||||
this.root.push(new Columns(mergedOptions.space));
|
||||
this.root.push(new DocumentGrid(mergedOptions.linePitch));
|
||||
|
||||
if (mergedOptions.differentFirstPageHeader) {
|
||||
this.root.push(
|
||||
new HeaderReference({
|
||||
headerType: HeaderReferenceType.FIRST,
|
||||
headerId: 5,
|
||||
}),
|
||||
);
|
||||
this.root.push(new TitlePage());
|
||||
}
|
||||
// TODO
|
||||
// if (mergedOptions.differentFirstPageHeader) {
|
||||
// this.root.push(
|
||||
// new HeaderReference({
|
||||
// headerType: HeaderReferenceType.FIRST,
|
||||
// headerId: 5,
|
||||
// }),
|
||||
// );
|
||||
// this.root.push(new TitlePage());
|
||||
// }
|
||||
|
||||
this.root.push(
|
||||
new HeaderReference({
|
||||
|
@ -6,7 +6,7 @@ import { Document } from "./document";
|
||||
import { FooterReferenceType, HeaderReferenceType } from "./document/body/section-properties";
|
||||
import { SectionPropertiesOptions } from "./document/body/section-properties/section-properties";
|
||||
import { FooterWrapper } from "./footer-wrapper";
|
||||
import { FirstPageHeaderWrapper, HeaderWrapper } from "./header-wrapper";
|
||||
import { HeaderWrapper } from "./header-wrapper";
|
||||
import { Media } from "./media";
|
||||
import { Numbering } from "./numbering";
|
||||
import { Hyperlink, Paragraph, PictureRun } from "./paragraph";
|
||||
@ -26,7 +26,6 @@ export class File {
|
||||
private readonly fileRelationships: Relationships;
|
||||
private readonly headerWrapper: HeaderWrapper[] = [];
|
||||
private readonly footerWrapper: FooterWrapper[] = [];
|
||||
private readonly firstPageHeaderWrapper: FirstPageHeaderWrapper;
|
||||
|
||||
private readonly contentTypes: ContentTypes;
|
||||
private readonly appProperties: AppProperties;
|
||||
@ -78,12 +77,6 @@ export class File {
|
||||
const footer = new FooterWrapper(this.media, this.nextId++);
|
||||
this.footerWrapper.push(footer);
|
||||
|
||||
this.docRelationships.createRelationship(
|
||||
5,
|
||||
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/header",
|
||||
"header2.xml",
|
||||
);
|
||||
|
||||
this.docRelationships.createRelationship(
|
||||
footer.Footer.referenceId,
|
||||
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer",
|
||||
@ -91,8 +84,6 @@ export class File {
|
||||
);
|
||||
this.contentTypes.addFooter(this.footerWrapper.length);
|
||||
|
||||
this.firstPageHeaderWrapper = new FirstPageHeaderWrapper(this.media, this.nextId++);
|
||||
|
||||
this.fileRelationships = new Relationships();
|
||||
this.fileRelationships.createRelationship(
|
||||
1,
|
||||
@ -243,10 +234,6 @@ export class File {
|
||||
return this.headerWrapper;
|
||||
}
|
||||
|
||||
public get firstPageHeader(): FirstPageHeaderWrapper {
|
||||
return this.firstPageHeaderWrapper;
|
||||
}
|
||||
|
||||
public HeaderByRefNumber(refId: number): HeaderWrapper {
|
||||
const entry = this.headerWrapper.find((h) => h.Header.referenceId === refId);
|
||||
if (entry) {
|
||||
|
@ -5,56 +5,6 @@ import { Paragraph } from "./paragraph";
|
||||
import { Relationships } from "./relationships";
|
||||
import { Table } from "./table";
|
||||
|
||||
export class FirstPageHeaderWrapper {
|
||||
private readonly header: Header;
|
||||
private readonly relationships: Relationships;
|
||||
|
||||
constructor(private readonly media: Media, referenceId: number) {
|
||||
this.header = new Header(referenceId);
|
||||
this.relationships = new Relationships();
|
||||
}
|
||||
|
||||
public addParagraph(paragraph: Paragraph): void {
|
||||
this.header.addParagraph(paragraph);
|
||||
}
|
||||
|
||||
public createParagraph(text?: string): Paragraph {
|
||||
const para = new Paragraph(text);
|
||||
this.addParagraph(para);
|
||||
return para;
|
||||
}
|
||||
|
||||
public addTable(table: Table): void {
|
||||
this.header.addTable(table);
|
||||
}
|
||||
|
||||
public createTable(rows: number, cols: number): Table {
|
||||
return this.header.createTable(rows, cols);
|
||||
}
|
||||
|
||||
public addDrawing(imageData: IMediaData): void {
|
||||
this.header.addDrawing(imageData);
|
||||
}
|
||||
|
||||
public createImage(image: string): void {
|
||||
const mediaData = this.media.addMedia(image, this.relationships.RelationshipCount);
|
||||
this.relationships.createRelationship(
|
||||
mediaData.referenceId,
|
||||
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",
|
||||
`media/${mediaData.fileName}`,
|
||||
);
|
||||
this.addDrawing(mediaData);
|
||||
}
|
||||
|
||||
public get Header(): Header {
|
||||
return this.header;
|
||||
}
|
||||
|
||||
public get Relationships(): Relationships {
|
||||
return this.relationships;
|
||||
}
|
||||
}
|
||||
|
||||
export class HeaderWrapper {
|
||||
private readonly header: Header;
|
||||
private readonly relationships: Relationships;
|
||||
|
Reference in New Issue
Block a user