Fix some linting errors
This commit is contained in:
@ -1,9 +1,8 @@
|
||||
import { XmlComponent } from "file/xml-components";
|
||||
import { ITemplateDocument } from "importDocx/importDocx";
|
||||
import { DocumentAttributes } from "../document/document-attributes";
|
||||
import { Created, Creator, Description, Keywords, LastModifiedBy, Modified, Revision, Subject, Title } from "./components";
|
||||
|
||||
import { TemplateDocument } from 'importDocx/importDocx'
|
||||
|
||||
export interface IPropertiesOptions {
|
||||
title?: string;
|
||||
subject?: string;
|
||||
@ -14,7 +13,7 @@ export interface IPropertiesOptions {
|
||||
revision?: string;
|
||||
externalStyles?: string;
|
||||
|
||||
templateDocument? : TemplateDocument;
|
||||
templateDocument?: ITemplateDocument;
|
||||
}
|
||||
|
||||
export class CoreProperties extends XmlComponent {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { expect } from "chai";
|
||||
|
||||
import { Formatter } from "../../../../export/formatter";
|
||||
import { PageBorderOffsetFrom, PageNumberFormat, FooterReferenceType, HeaderReferenceType } from "./";
|
||||
import { FooterReferenceType, HeaderReferenceType, PageBorderOffsetFrom, PageNumberFormat } from "./";
|
||||
import { SectionProperties } from "./section-properties";
|
||||
|
||||
describe("SectionProperties", () => {
|
||||
|
@ -93,7 +93,7 @@ export class File {
|
||||
if (!templateHeaders) {
|
||||
this.createHeader();
|
||||
} else {
|
||||
for (let templateHeader of templateHeaders) {
|
||||
for (const templateHeader of templateHeaders) {
|
||||
this.addHeaderToDocument(templateHeader.header, templateHeader.type);
|
||||
}
|
||||
}
|
||||
@ -102,7 +102,7 @@ export class File {
|
||||
if (!templateFooters) {
|
||||
this.createFooter();
|
||||
} else {
|
||||
for (let templateFooter of templateFooters) {
|
||||
for (const templateFooter of templateFooters) {
|
||||
this.addFooterToDocument(templateFooter.footer, templateFooter.type);
|
||||
}
|
||||
}
|
||||
@ -127,16 +127,16 @@ export class File {
|
||||
|
||||
this.footNotes = new FootNotes();
|
||||
|
||||
let headersOptions: IHeaderOptions[] = [];
|
||||
for (let documentHeader of this.documentHeaders) {
|
||||
const headersOptions: IHeaderOptions[] = [];
|
||||
for (const documentHeader of this.documentHeaders) {
|
||||
headersOptions.push({
|
||||
headerId: documentHeader.header.Header.ReferenceId,
|
||||
headerType: documentHeader.type,
|
||||
});
|
||||
}
|
||||
|
||||
let footersOptions: IFooterOptions[] = [];
|
||||
for (let documentFooter of this.documentFooters) {
|
||||
const footersOptions: IFooterOptions[] = [];
|
||||
for (const documentFooter of this.documentFooters) {
|
||||
footersOptions.push({
|
||||
footerId: documentFooter.footer.Footer.ReferenceId,
|
||||
footerType: documentFooter.type,
|
||||
@ -148,8 +148,7 @@ export class File {
|
||||
headers: headersOptions,
|
||||
footers: footersOptions,
|
||||
};
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
sectionPropertiesOptions.headers = headersOptions;
|
||||
sectionPropertiesOptions.footers = footersOptions;
|
||||
}
|
||||
@ -225,7 +224,7 @@ export class File {
|
||||
return header;
|
||||
}
|
||||
|
||||
private addHeaderToDocument(header: HeaderWrapper, type: HeaderReferenceType = HeaderReferenceType.DEFAULT) {
|
||||
private addHeaderToDocument(header: HeaderWrapper, type: HeaderReferenceType = HeaderReferenceType.DEFAULT): void {
|
||||
this.documentHeaders.push({ header, type });
|
||||
this.docRelationships.createRelationship(
|
||||
header.Header.ReferenceId,
|
||||
@ -241,7 +240,7 @@ export class File {
|
||||
return footer;
|
||||
}
|
||||
|
||||
private addFooterToDocument(footer: FooterWrapper, type: FooterReferenceType = FooterReferenceType.DEFAULT) {
|
||||
private addFooterToDocument(footer: FooterWrapper, type: FooterReferenceType = FooterReferenceType.DEFAULT): void {
|
||||
this.documentFooters.push({ footer, type });
|
||||
this.docRelationships.createRelationship(
|
||||
footer.Footer.ReferenceId,
|
||||
|
@ -1,11 +1,10 @@
|
||||
import { IMediaData } from "file/media";
|
||||
import { XmlComponent } from "file/xml-components";
|
||||
import { Header } from "./header/header";
|
||||
import { Image, Media } from "./media";
|
||||
import { ImageParagraph, Paragraph } from "./paragraph";
|
||||
import { Relationships } from "./relationships";
|
||||
import { Table } from "./table";
|
||||
import { IMediaData } from 'file/media';
|
||||
|
||||
|
||||
export class HeaderWrapper {
|
||||
private readonly header: Header;
|
||||
@ -13,7 +12,7 @@ export class HeaderWrapper {
|
||||
public readonly media = new Media();
|
||||
|
||||
// constructor(private readonly media: Media, referenceId: number, initContent? : XmlComponent) {
|
||||
constructor(referenceId: number, initContent? : XmlComponent) {
|
||||
constructor(referenceId: number, initContent?: XmlComponent) {
|
||||
this.header = new Header(referenceId, initContent);
|
||||
this.relationships = new Relationships();
|
||||
}
|
||||
@ -40,7 +39,7 @@ export class HeaderWrapper {
|
||||
this.header.addChildElement(childElement);
|
||||
}
|
||||
|
||||
public addImageRelation(image: Buffer, refId : number, width?: number, height?: number) : IMediaData {
|
||||
public addImageRelation(image: Buffer, refId: number, width?: number, height?: number): IMediaData {
|
||||
const mediaData = this.media.addMedia(image, refId, width, height);
|
||||
this.relationships.createRelationship(
|
||||
refId,
|
||||
@ -49,9 +48,9 @@ export class HeaderWrapper {
|
||||
);
|
||||
return mediaData;
|
||||
}
|
||||
|
||||
|
||||
public createImage(image: Buffer, width?: number, height?: number): void {
|
||||
let mediaData = this.addImageRelation(image, this.relationships.RelationshipCount, width, height);
|
||||
const mediaData = this.addImageRelation(image, this.relationships.RelationshipCount, width, height);
|
||||
this.addImage(new Image(new ImageParagraph(mediaData)));
|
||||
}
|
||||
|
||||
|
@ -39,8 +39,8 @@ export class Header extends XmlComponent {
|
||||
cx6: "http://schemas.microsoft.com/office/drawing/2016/5/12/chartex",
|
||||
cx7: "http://schemas.microsoft.com/office/drawing/2016/5/13/chartex",
|
||||
cx8: "http://schemas.microsoft.com/office/drawing/2016/5/14/chartex",
|
||||
w16cid: "http://schemas.microsoft.com/office/word/2016/wordml/cid",
|
||||
w16se: "http://schemas.microsoft.com/office/word/2015/wordml/symex"
|
||||
w16cid: "http://schemas.microsoft.com/office/word/2016/wordml/cid",
|
||||
w16se: "http://schemas.microsoft.com/office/word/2015/wordml/symex",
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ export { BaseXmlComponent };
|
||||
export abstract class XmlComponent extends BaseXmlComponent {
|
||||
public root: Array<BaseXmlComponent | string>;
|
||||
|
||||
constructor(rootKey: string, initContent? : XmlComponent) {
|
||||
constructor(rootKey: string, initContent?: XmlComponent) {
|
||||
super(rootKey);
|
||||
this.root = initContent ? initContent.root : new Array<BaseXmlComponent>();
|
||||
}
|
||||
|
Reference in New Issue
Block a user