trying to get numbering to work
This commit is contained in:
@ -4,11 +4,12 @@ import * as express from "express";
|
||||
import {Document} from "../../docx/document";
|
||||
import {Properties} from "../../properties";
|
||||
import {DefaultStylesFactory} from "../../styles/factory"
|
||||
import {Numbering} from "../../numbering";
|
||||
|
||||
export class ExpressPacker extends Packer {
|
||||
private res: express.Response;
|
||||
|
||||
constructor(document: Document, res: express.Response, styles?: any, properties?: Properties) {
|
||||
constructor(document: Document, res: express.Response, styles?: any, properties?: Properties, numbering?: Numbering) {
|
||||
if (!styles) {
|
||||
var stylesFactory = new DefaultStylesFactory();
|
||||
styles = stylesFactory.newInstance()
|
||||
@ -22,7 +23,11 @@ export class ExpressPacker extends Packer {
|
||||
});
|
||||
}
|
||||
|
||||
super(document, styles, properties);
|
||||
if (!numbering) {
|
||||
numbering = new Numbering();
|
||||
}
|
||||
|
||||
super(document, styles, properties, numbering);
|
||||
this.res = res;
|
||||
|
||||
this.res.on('close', () => {
|
||||
|
@ -2,12 +2,18 @@ import {Packer} from "./packer";
|
||||
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
|
||||
|
||||
constructor(document: Document, style: any, properties: Properties, path: string) {
|
||||
super(document, style, properties);
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -53,6 +53,8 @@ export abstract class Packer {
|
||||
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(xmlNumbering);
|
||||
|
||||
this.archive.append(xmlDocument, {
|
||||
name: 'word/document.xml'
|
||||
});
|
||||
|
Reference in New Issue
Block a user