Add File alias to Document for backwards compatability

This commit is contained in:
Dolan
2018-01-31 00:32:13 +00:00
parent 6d0a267ba4
commit 35dbce3a68
11 changed files with 13 additions and 11 deletions

View File

@ -1,6 +1,6 @@
const docx = require('../build'); const docx = require('../build');
var doc = new docx.File(); var doc = new docx.Document();
var paragraph = new docx.Paragraph("Hello World"); var paragraph = new docx.Paragraph("Hello World");
var institutionText = new docx.TextRun("University College London").bold(); var institutionText = new docx.TextRun("University College London").bold();

View File

@ -1,6 +1,6 @@
const docx = require('../build'); const docx = require('../build');
const doc = new docx.File({ const doc = new docx.Document({
creator: 'Clippy', creator: 'Clippy',
title: 'Sample Document', title: 'Sample Document',
description: 'A brief example of using docx', description: 'A brief example of using docx',

View File

@ -1,6 +1,6 @@
const docx = require('../build'); const docx = require('../build');
var doc = new docx.File(); var doc = new docx.Document();
const numbering = new docx.Numbering(); const numbering = new docx.Numbering();

View File

@ -1,6 +1,6 @@
const docx = require('../build'); const docx = require('../build');
var doc = new docx.File(); var doc = new docx.Document();
const table = doc.createTable(4, 4); const table = doc.createTable(4, 4);
table.getCell(2, 2).addContent(new docx.Paragraph('Hello')); table.getCell(2, 2).addContent(new docx.Paragraph('Hello'));

View File

@ -1,6 +1,6 @@
const docx = require('../build'); const docx = require('../build');
var doc = new docx.File(); var doc = new docx.Document();
var paragraph = new docx.Paragraph("Hello World"); var paragraph = new docx.Paragraph("Hello World");
doc.addParagraph(paragraph); doc.addParagraph(paragraph);

View File

@ -1,6 +1,6 @@
const docx = require("../build"); const docx = require("../build");
var doc = new docx.File(undefined, { var doc = new docx.Document(undefined, {
top: 0, top: 0,
right: 0, right: 0,
bottom: 0, bottom: 0,

View File

@ -1,6 +1,6 @@
const docx = require("../build"); const docx = require("../build");
var doc = new docx.File(undefined, { var doc = new docx.Document(undefined, {
orientation: "landscape", orientation: "landscape",
}); });

View File

@ -1,6 +1,6 @@
const docx = require('../build'); const docx = require('../build');
var doc = new docx.File(); var doc = new docx.Document();
doc.createParagraph("Hello World"); doc.createParagraph("Hello World");

View File

@ -1,11 +1,11 @@
const docx = require('../build'); const docx = require('../build');
var doc = new docx.File(); var doc = new docx.Document();
doc.createParagraph("Hello World"); doc.createParagraph("Hello World");
doc.Header.createImage("./demo/images/pizza.gif"); doc.Header.createImage("./demo/images/pizza.gif");
// doc.Footer.createImage("./demo/images/pizza.gif"); doc.Footer.createImage("./demo/images/pizza.gif");
var exporter = new docx.LocalPacker(doc); var exporter = new docx.LocalPacker(doc);
exporter.pack('My Document'); exporter.pack('My Document');

View File

@ -1,4 +1,3 @@
export * from "./document";
export * from "./paragraph"; export * from "./paragraph";
export * from "./table"; export * from "./table";
export * from "./file"; export * from "./file";

View File

@ -1,2 +1,5 @@
// Internally, the wrapper is a 'File', but export to the end user as a 'Document'
// Use of 'File' also works
export { File as Document } from "./file";
export * from "./file"; export * from "./file";
export * from "./export"; export * from "./export";