Put docx in a seperate namespace in the browser version rather than the global namespace

This commit is contained in:
Dolan Miu
2019-10-12 22:16:36 +01:00
parent 50911fff57
commit 75cdae1473
2 changed files with 17 additions and 15 deletions

View File

@ -12,18 +12,18 @@
<script>
function generate() {
const doc = new Document();
const doc = new docx.Document();
doc.addSection({
children: [
new Paragraph({
new docx.Paragraph({
children: [
new TextRun("Hello World"),
new TextRun({
new docx.TextRun("Hello World"),
new docx.TextRun({
text: "Foo Bar",
bold: true,
}),
new TextRun({
new docx.TextRun({
text: "Github is the best",
bold: true,
}).tab(),
@ -34,7 +34,7 @@
Packer.toBlob(doc).then((blob) => {
docx.Packer.toBlob(doc).then((blob) => {
console.log(blob);
saveAs(blob, "example.docx");
console.log("Document created successfully");