further clean up border code; update paragraph borders to use shared type; BREAKING: paragraph border value attr renamed to style, to match other usages of borders

This commit is contained in:
Tom Hunkapiller
2021-05-23 08:00:49 +03:00
parent 54ab55b92c
commit 08bd2744b6
18 changed files with 100 additions and 115 deletions

View File

@ -1,7 +1,7 @@
// Creates two paragraphs, one with a border and one without
// Import from 'docx' rather than '../build' if you install from npm
import * as fs from "fs";
import { Document, Packer, Paragraph } from "../build";
import { BorderStyle, Document, Packer, Paragraph } from "../build";
const doc = new Document({
sections: [
@ -14,13 +14,13 @@ const doc = new Document({
top: {
color: "auto",
space: 1,
value: "single",
style: BorderStyle.SINGLE,
size: 6,
},
bottom: {
color: "auto",
space: 1,
value: "single",
style: BorderStyle.SINGLE,
size: 6,
},
},

View File

@ -1,7 +1,16 @@
// Text Frame (Text Box) example
// Import from 'docx' rather than '../build' if you install from npm
import * as fs from "fs";
import { Document, FrameAnchorType, HorizontalPositionAlign, Packer, Paragraph, TextRun, VerticalPositionAlign } from "../build";
import {
BorderStyle,
Document,
FrameAnchorType,
HorizontalPositionAlign,
Packer,
Paragraph,
TextRun,
VerticalPositionAlign,
} from "../build";
const doc = new Document({
sections: [
@ -29,25 +38,25 @@ const doc = new Document({
top: {
color: "auto",
space: 1,
value: "single",
style: BorderStyle.SINGLE,
size: 6,
},
bottom: {
color: "auto",
space: 1,
value: "single",
style: BorderStyle.SINGLE,
size: 6,
},
left: {
color: "auto",
space: 1,
value: "single",
style: BorderStyle.SINGLE,
size: 6,
},
right: {
color: "auto",
space: 1,
value: "single",
style: BorderStyle.SINGLE,
size: 6,
},
},