fixed all tslint errors

This commit is contained in:
Dolan Miu
2016-05-26 15:08:34 +01:00
parent f075d3b719
commit a2284df881
42 changed files with 253 additions and 254 deletions

View File

@ -3,7 +3,7 @@ import * as fs from "fs";
import * as express from "express";
import {Document} from "../../docx/document";
import {Properties} from "../../properties";
import {DefaultStylesFactory} from "../../styles/factory"
import {DefaultStylesFactory} from "../../styles/factory";
import {Numbering} from "../../numbering";
export class ExpressPacker extends Packer {
@ -11,8 +11,8 @@ export class ExpressPacker extends Packer {
constructor(document: Document, res: express.Response, styles?: any, properties?: Properties, numbering?: Numbering) {
if (!styles) {
var stylesFactory = new DefaultStylesFactory();
styles = stylesFactory.newInstance()
let stylesFactory = new DefaultStylesFactory();
styles = stylesFactory.newInstance();
}
if (!properties) {
@ -22,7 +22,7 @@ export class ExpressPacker extends Packer {
lastModifiedBy: "Shan Fu"
});
}
if (!numbering) {
numbering = new Numbering();
}
@ -30,8 +30,8 @@ export class ExpressPacker extends Packer {
super(document, styles, properties, numbering);
this.res = res;
this.res.on('close', () => {
return res.status(200).send('OK').end();
this.res.on("close", () => {
return res.status(200).send("OK").end();
});
}

View File

@ -1,23 +1,23 @@
import {Packer} from "./packer";
import * as fs from 'fs';
import * as fs from "fs";
import {Document} from "../../docx/document";
import {Properties} from "../../properties";
import {Numbering} from "../../numbering";
export class LocalPacker extends Packer {
private stream: fs.WriteStream
private stream: fs.WriteStream;
constructor(document: Document, style: any, properties: Properties, path: string, numbering?: Numbering) {
if (!numbering) {
numbering = new Numbering();
}
super(document, style, properties, numbering);
this.stream = fs.createWriteStream(path);
}
pack(): void {
super.pack(this.stream);
}
pack(): void {
super.pack(this.stream);
}
}

View File

@ -7,7 +7,7 @@ import {Styles} from "../../styles";
import {Properties} from "../../properties";
import {Numbering} from "../../numbering";
var appRoot = require('app-root-path');
let appRoot = require("app-root-path");
export abstract class Packer {
protected archive: any;
@ -16,7 +16,7 @@ export abstract class Packer {
private style: Styles;
private properties: Properties;
private numbering: Numbering;
constructor(document: Document, style: any, properties: Properties, numbering: Numbering) {
this.formatter = new Formatter();
this.document = document;
@ -25,7 +25,7 @@ export abstract class Packer {
this.numbering = numbering;
this.archive = archiver.create("zip", {});
this.archive.on('error', (err) => {
this.archive.on("error", (err) => {
throw err;
});
}
@ -37,39 +37,39 @@ export abstract class Packer {
{
expand: true,
cwd: appRoot.path + "/template",
src: ['**', '**/.rels']
src: ["**", "**/.rels"]
}
]);
//this.archive.file(appRoot.path + "/template/[Content_Types].xml", { name: "[Content_Types].xml" });
//console.log(__dirname + "/packer.js");
//this.archive.file(__dirname + "/packer.js", { name: "/[Content_Types].xml" });
// this.archive.file(appRoot.path + "/template/[Content_Types].xml", { name: "[Content_Types].xml" });
// console.log(__dirname + "/packer.js");
// this.archive.file(__dirname + "/packer.js", { name: "/[Content_Types].xml" });
/*this.archive.directory(appRoot.path + "/template", {
name: "/root/g.txt",
prefix: "root"
});*/
var xmlDocument = xml(this.formatter.format(this.document));
var xmlStyles = xml(this.formatter.format(this.style));
var xmlProperties = xml(this.formatter.format(this.properties), { declaration: { standalone: 'yes', encoding: 'UTF-8' } });
var xmlNumbering = xml(this.formatter.format(this.numbering));
//console.log(JSON.stringify(this.numbering, null, " "));
console.log(xmlNumbering);
let xmlDocument = xml(this.formatter.format(this.document));
let xmlStyles = xml(this.formatter.format(this.style));
let xmlProperties = xml(this.formatter.format(this.properties), { declaration: { standalone: "yes", encoding: "UTF-8" } });
let xmlNumbering = xml(this.formatter.format(this.numbering));
// console.log(JSON.stringify(this.numbering, null, " "));
console.log(xmlNumbering);
this.archive.append(xmlDocument, {
name: 'word/document.xml'
name: "word/document.xml"
});
this.archive.append(xmlStyles, {
name: 'word/styles.xml'
name: "word/styles.xml"
});
this.archive.append(xmlProperties, {
name: 'docProps/core.xml'
name: "docProps/core.xml"
});
this.archive.append(xmlNumbering, {
name: 'word/numbering.xml'
})
name: "word/numbering.xml"
});
this.archive.finalize();
}