Fix linting errors
This commit is contained in:
@ -1,16 +1,18 @@
|
||||
import { Document, Packer, Paragraph, ImportDocx } from "../build";
|
||||
import * as fs from "fs";
|
||||
import { Document, ImportDocx, Packer, Paragraph } from "../build";
|
||||
|
||||
let importDocx = new ImportDocx();
|
||||
const importDocx = new ImportDocx();
|
||||
const filePath = "./demo/dotx/template.dotx";
|
||||
|
||||
fs.readFile(filePath, (err, data) => {
|
||||
if (err) {
|
||||
console.error(`failed to read file ${filePath}.`);
|
||||
throw new Error(`Failed to read file ${filePath}.`);
|
||||
}
|
||||
else {
|
||||
importDocx.extract(data).then(templateDocument => {
|
||||
let options = {};
|
||||
options['templateDocument'] = templateDocument;
|
||||
|
||||
importDocx.extract(data).then((templateDocument) => {
|
||||
const options = {
|
||||
templateDocument,
|
||||
};
|
||||
|
||||
const doc = new Document(options);
|
||||
const paragraph = new Paragraph("Hello World");
|
||||
@ -19,9 +21,6 @@ fs.readFile(filePath, (err, data) => {
|
||||
const packer = new Packer();
|
||||
packer.toBuffer(doc).then((buffer) => {
|
||||
fs.writeFileSync("My Document.docx", buffer);
|
||||
console.log('done. open MyDocument.docx');
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
});
|
@ -6,9 +6,9 @@ import {
|
||||
FooterReferenceType,
|
||||
HeaderReference,
|
||||
HeaderReferenceType,
|
||||
SectionPropertiesOptions,
|
||||
IHeaderOptions,
|
||||
IFooterOptions,
|
||||
IHeaderOptions,
|
||||
SectionPropertiesOptions,
|
||||
} from "./document/body/section-properties";
|
||||
import { FooterWrapper } from "./footer-wrapper";
|
||||
import { FootNotes } from "./footnotes";
|
||||
@ -22,8 +22,8 @@ import { ExternalStylesFactory } from "./styles/external-styles-factory";
|
||||
import { DefaultStylesFactory } from "./styles/factory";
|
||||
import { Table } from "./table";
|
||||
|
||||
type DocumentHeaders = { header: HeaderWrapper; type: HeaderReferenceType }[];
|
||||
type DocumentFooters = { footer: FooterWrapper; type: FooterReferenceType }[];
|
||||
type DocumentHeaders = Array<{ header: HeaderWrapper; type: HeaderReferenceType }>;
|
||||
type DocumentFooters = Array<{ footer: FooterWrapper; type: FooterReferenceType }>;
|
||||
|
||||
export class File {
|
||||
private readonly document: Document;
|
||||
|
Reference in New Issue
Block a user