@@ -18,33 +18,51 @@ npm install --save docx
Then you can `require` or `import` as usual:
-```js
-let docx = require("docx");
+```ts
+const docx = require("docx");
```
-```js
+```ts
import * as docx from "docx";
+// or
+import { ... } from "docx";
```
## Basic Usage
-```js
-var fs = require("fs");
-var docx = require("docx");
+```ts
+import * as fs from "fs";
+import { Document, Packer, Paragraph, TextRun } from "docx";
// Create document
-var doc = new docx.Document();
+const doc = new Document();
-// Add some content in the document
-var paragraph = new docx.Paragraph("Some cool text here.");
-// Add more text into the paragraph if you wish
-paragraph.addRun(new docx.TextRun("Lorem Ipsum Foo Bar"));
-doc.addParagraph(paragraph);
+// Documents contain sections, you can have multiple sections per document, go here to learn more about sections
+// This simple example will only contain one section
+doc.addSection({
+ properties: {},
+ children: [
+ new Paragraph({
+ children: [
+ new TextRun("Hello World"),
+ new TextRun({
+ text: "Foo Bar",
+ bold: true,
+ }),
+ new TextRun({
+ text: "Github is the best",
+ bold: true,
+ }).tab(),
+ ],
+ }),
+ ],
+});
// Used to export the file into a .docx file
-var packer = new docx.Packer();
+const packer = new Packer();
+
packer.toBuffer(doc).then((buffer) => {
- fs.writeFileSync("My First Document.docx", buffer);
+ fs.writeFileSync("My Document.docx", buffer);
});
// Done! A file called 'My First Document.docx' will be in your file system.
diff --git a/_sidebar.md b/_sidebar.md
index 558029dbf6..9e329b6448 100644
--- a/_sidebar.md
+++ b/_sidebar.md
@@ -9,6 +9,7 @@
* Usage
* [Document](usage/document.md)
+ * [Sections](usage/sections.md)
* [Paragraph](usage/paragraph.md)
* [Text](usage/text.md)
* [Image](usage/images.md)
diff --git a/api/classes/abstractnumbering.html b/api/classes/abstractnumbering.html
index 0037035715..78499040f8 100644
--- a/api/classes/abstractnumbering.html
+++ b/api/classes/abstractnumbering.html
@@ -125,7 +125,7 @@
diff --git a/contribution-guidelines.md b/contribution-guidelines.md
index 7f61964032..1305c4c4bd 100644
--- a/contribution-guidelines.md
+++ b/contribution-guidelines.md
@@ -2,7 +2,7 @@
* Include documentation reference(s) at the top of each file:
- ```js
+ ```ts
// http://officeopenxml.com/WPdocument.php
```
@@ -44,7 +44,7 @@ Try to make method parameters of the outside API accept primitives, or `json` ob
This is so that:
1. Imports are much cleaner for the end user, no need for:
- ```js
+ ```ts
import { ChildComponent } from "./my-feature/sub-component/deeper/.../my-deep.component";
```
@@ -55,7 +55,7 @@ This is so that:
`TableFloatProperties` is a class. The outside world would have to `new` up the object, and inject it in like so:
-```js
+```ts
public float(tableFloatProperties: TableFloatProperties): Table
```
@@ -67,7 +67,7 @@ This is so that:
`ITableFloatOptions` is an interface for a JSON of primitives. The end user would need to pass in a json object and not need to worry about the internals:
-```js
+```ts
public float(tableFloatOptions: ITableFloatOptions): Table
```
@@ -81,7 +81,7 @@ This is just a guideline, and the rules can sometimes be broken.
* Use `create` if the method `new`'s up an element inside:
- ```js
+ ```ts
public createParagraph() {
const paragraph = new Paragraph();
this.root.push(paragraph);
@@ -91,8 +91,8 @@ This is just a guideline, and the rules can sometimes be broken.
* Use `add` if you add the element into the method as a parameter.
*Note:* This may look like its breaking the previous guideline, but it has semantically different meanings. The previous one is using data to construct an object, whereas this one is simply adding elements into the document:
- ```js
- public addParagraph(paragraph: Paragraph) {
+ ```ts
+ public add(paragraph: Paragraph) {
this.root.push(paragraph);
}
```
@@ -101,7 +101,7 @@ This is just a guideline, and the rules can sometimes be broken.
Getters and Setters are done with a capital letter like so:
-```js
+```ts
public get Level() {
...
}
@@ -111,13 +111,13 @@ There is no performance advantage by doing this. It means we don't need to prefi
**Do not:**
-```js
+```ts
private get _level: string;
```
**Do**
-```js
+```ts
private get level: string;
```
@@ -158,13 +158,13 @@ Do not use `type`, but rather use `Interfaces`. `type` cannot be extended, and a
**Do not:**
-```js
+```ts
type RelationshipFileInfo = { id: number, target: string };
```
**Do:**
-```js
+```ts
interface IRelationshipFileInfo {
id: number;
target: string;
@@ -177,13 +177,13 @@ To take full advantage of TypeScript's typing system, its best to use `string en
**Do not:**
-```js
+```ts
type WeaponType = "bow" | "sword" | "wand";
```
**Do:**
-```js
+```ts
enum WeaponType = {
BOW = "bow",
SWORD = "sword",
@@ -196,7 +196,7 @@ enum WeaponType = {
I am not sure where these habits in software development come from, but I do not believe it is beneficial:
**Do not:**
-```js
+```ts
readdy // misspelling
perm // abbreviation
conf // abbreviation
@@ -206,7 +206,7 @@ colour // U.K. English
```
**Do:**
-```js
+```ts
ready
permission
config
@@ -231,7 +231,7 @@ Please write a test of every file you make and suffix it with `.spec.ts`.
Here is a template of a test:
-```js
+```ts
import { assert } from "chai";
describe("ClassName", () => {
diff --git a/usage/bullet-points.md b/usage/bullet-points.md
index c2fb2987d0..dde800ec4d 100644
--- a/usage/bullet-points.md
+++ b/usage/bullet-points.md
@@ -4,15 +4,15 @@
To make a bullet point, simply make a paragraph into a bullet point:
-```js
-var text = new docx.TextRun("Bullet points");
-var paragraph = new docx.Paragraph(text).bullet();
+```ts
+const text = new docx.TextRun("Bullet points");
+const paragraph = new docx.Paragraph(text).bullet();
-var text2 = new docx.TextRun("Are awesome");
-var paragraph2 = new docx.Paragraph(text2).bullet();
+const text2 = new docx.TextRun("Are awesome");
+const paragraph2 = new docx.Paragraph(text2).bullet();
-doc.addParagraph(paragraph);
-doc.addParagraph(paragraph2);
+doc.add(paragraph);
+doc.add(paragraph2);
```
### This will produce:
diff --git a/usage/document.md b/usage/document.md
index 175e4ecad1..bf06d30613 100644
--- a/usage/document.md
+++ b/usage/document.md
@@ -4,7 +4,7 @@
To create a new document, it is very easy:
-```js
+```ts
const doc = new docx.Document();
```
@@ -12,7 +12,7 @@ const doc = new docx.Document();
You can add properties to the Word document by specifying options, for example:
-```js
+```ts
const doc = new docx.Document({
creator: "Dolan Miu",
description: "My extremely interesting document",
@@ -33,7 +33,7 @@ const doc = new docx.Document({
You can mix and match whatever properties you want, or provide no properties.
-### units for positioning
+### Units for positioning
Various parts of the API require positioning arguments. The units are "20ths of a point" from the [OOXML](http://officeopenxml.com/index.php) specification.
-See [Lars Corneliussen's blog post](https://startbigthinksmall.wordpress.com/2010/01/04/points-inches-and-emus-measuring-units-in-office-open-xml/) for more information and how to convert units.
\ No newline at end of file
+See [Lars Corneliussen's blog post](https://startbigthinksmall.wordpress.com/2010/01/04/points-inches-and-emus-measuring-units-in-office-open-xml/) for more information and how to convert units.
diff --git a/usage/headers-and-footers.md b/usage/headers-and-footers.md
index 22951abdee..f93cae332c 100644
--- a/usage/headers-and-footers.md
+++ b/usage/headers-and-footers.md
@@ -1,24 +1,26 @@
# Headers and Footers
+!> Headers and Footers requires an understanding of [Sections](usage/sections.md).
+
## Example
Creating Headers and footers is simple. Access the `Header` and `Footer` by doing so like this:
-```js
+```ts
doc.Header;
doc.Footer;
```
You can call the same methods as you would with a `File`:
-```js
+```ts
doc.Header.createParagraph("Header text");
doc.Footer.createParagraph("Footer text");
```
Even add images:
-```js
+```ts
doc.Header.createImage([BUFFER_OF_YOUR_IMAGE]);
doc.Footer.createImage([BUFFER_OF_YOUR_IMAGE]);
```
@@ -31,7 +33,7 @@ Also all the supported section properties are implemented according to: http://o
### Example
-```js
+```ts
const header = this.document.createHeader();
const footer = this.document.createFooter();
diff --git a/usage/images.md b/usage/images.md
index 8f4c34643c..693b2d4781 100644
--- a/usage/images.md
+++ b/usage/images.md
@@ -1,9 +1,11 @@
# Images
+!> Images requires an understanding of [Sections](usage/sections.md) and [Paragraphs](usage/paragraph.md).
+
To create a `floating` image on top of text:
```ts
-doc.createImage(fs.readFileSync("./demo/images/pizza.gif"), 200, 200, {
+Media.addImage(doc, fs.readFileSync("./demo/images/pizza.gif"), 200, 200, {
floating: {
horizontalPosition: {
offset: 1014400,
@@ -18,14 +20,27 @@ doc.createImage(fs.readFileSync("./demo/images/pizza.gif"), 200, 200, {
By default with no arguments, its an `inline` image:
```ts
-doc.createImage(fs.readFileSync("./demo/images/parrots.bmp"));
+const image = Media.addImage(doc, fs.readFileSync("./demo/images/pizza.gif"));
```
-You can also create images manually and add them later:
+Add it into the document by adding the image into a paragraph:
```ts
-const image = Media.addImage(doc, fs.readFileSync("./demo/images/pizza.gif"));
-doc.addImage(image);
+doc.addSection({
+ children: [new Paragraph(image)],
+});
+```
+
+Or:
+
+```ts
+doc.addSection({
+ children: [
+ new Paragraph({
+ children: [image],
+ }),
+ ],
+});
```
## Intro
@@ -34,15 +49,17 @@ Adding images can be done in two ways:
1. Call the `createImage` method to add the image directly into the `document`:
- ```js
- doc.createImage([IMAGE_BUFFER], [WIDTH], [HEIGHT], [POSITION_OPTIONS]);
+ ```ts
+ Media.addImage(doc, [IMAGE_BUFFER], [WIDTH], [HEIGHT], [POSITION_OPTIONS]);
```
2. Create an `image` first, then add it into the `document`:
```ts
const image = Media.addImage(doc, [IMAGE_BUFFER]);
- doc.addImage(image);
+ doc.addSection({
+ children: [new Paragraph(image)],
+ });
```
`docx` supports `jpeg`, `jpg`, `bmp`, `gif` and `png`
@@ -141,7 +158,7 @@ wrap: {
For example:
```ts
-doc.createImage(fs.readFileSync("./demo/images/pizza.gif"), 200, 200, {
+Media.addImage(doc, fs.readFileSync("./demo/images/pizza.gif"), 200, 200, {
floating: {
horizontalPosition: {
offset: 2014400,
@@ -184,7 +201,7 @@ margins: {
For example:
```ts
-doc.createImage(fs.readFileSync("./demo/images/pizza.gif"), 200, 200, {
+Media.addImage(doc, fs.readFileSync("./demo/images/pizza.gif"), 200, 200, {
floating: {
horizontalPosition: {
offset: 2014400,
@@ -210,7 +227,7 @@ doc.createImage(fs.readFileSync("./demo/images/pizza.gif"), 200, 200, {
Importing Images from file system path
-[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo5.ts ':include')
+[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo5.ts ":include")
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo5.ts_
@@ -218,7 +235,7 @@ _Source: https://github.com/dolanmiu/docx/blob/master/demo/demo5.ts_
Example showing how to add image to headers and footers
-[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo9.ts ':include')
+[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo9.ts ":include")
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo9.ts_
@@ -226,6 +243,6 @@ _Source: https://github.com/dolanmiu/docx/blob/master/demo/demo9.ts_
Example showing how to float images on top of text and optimally give a `margin`
-[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo38.ts ':include')
+[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo38.ts ":include")
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo38.ts_
diff --git a/usage/numbering.md b/usage/numbering.md
index ba8f10cdba..1f61c53dca 100644
--- a/usage/numbering.md
+++ b/usage/numbering.md
@@ -67,7 +67,7 @@ First you need to create a new numbering container class and use it to
create your abstract numbering style, define your levels, and create
your concrete numbering style:
-```js
+```ts
const numbering = new docx.Numbering();
const abstractNum = numbering.createAbstractNumbering();
@@ -81,7 +81,7 @@ const concrete = numbering.createConcreteNumbering(abstractNum);
You can then apply your concrete style to paragraphs using the
`setNumbering` method:
-```js
+```ts
topLevelP.setNumbering(concrete, 0);
subP.setNumbering(concrete, 1);
subSubP.setNumbering(concrete, 2);
@@ -90,7 +90,7 @@ subSubP.setNumbering(concrete, 2);
Finally, you need to let your exporter know about your numbering
styles when you're ready to render the document:
-```js
+```ts
const packer = new Packer(doc, undefined, undefined, numbering);
packer.pack(myOutput);
```
diff --git a/usage/packers.md b/usage/packers.md
index 11f107390d..274942b715 100644
--- a/usage/packers.md
+++ b/usage/packers.md
@@ -10,7 +10,7 @@ Packers in `version 4` and above are now one single `Packer`. It works in both a
This will return a NodeJS `Buffer`. If this is used in the browser, it will return a `UInt8Array` instead.
-```js
+```ts
const packer = new docx.Packer();
packer.toBuffer(doc).then((buffer) => {
@@ -20,7 +20,7 @@ packer.toBuffer(doc).then((buffer) => {
### Export as a `base64` string
-```js
+```ts
const packer = new docx.Packer();
packer.toBase64String(doc).then((string) => {
@@ -32,7 +32,7 @@ packer.toBase64String(doc).then((string) => {
This is useful if you want to send it as an downloadable in a browser environment.
-```js
+```ts
const packer = new docx.Packer();
packer.toBlob(doc).then((blob) => {
@@ -45,7 +45,7 @@ packer.toBlob(doc).then((blob) => {
### File System Packer
-```js
+```ts
const docx = require("docx");
const doc = new docx.Document();
@@ -56,7 +56,7 @@ exporter.pack("My Document");
### Buffer Packer
-```js
+```ts
const docx = require("docx");
const doc = new docx.Document();
@@ -68,7 +68,7 @@ const buffer = exporter.pack();
Creates a `node` `Readable` stream
-```js
+```ts
const docx = require("docx");
const doc = new docx.Document();
@@ -88,7 +88,7 @@ I used the express exporter in my [website](http://www.dolan.bio).
The recommended way is to use the `StreamPacker` and handle the `express` magic outside of the library:
-```js
+```ts
const docx = require("docx");
const doc = new docx.Document();
@@ -107,7 +107,7 @@ where `res` is the response object obtained through the Express router. It is th
You can export your word document as a PDF file like so:
-```js
+```ts
const exporter = new docx.LocalPacker(doc);
exporter.packPdf("My Document");
diff --git a/usage/paragraph.md b/usage/paragraph.md
index 6864bd1e73..a398c82e40 100644
--- a/usage/paragraph.md
+++ b/usage/paragraph.md
@@ -2,28 +2,180 @@
> Everything (text, images, graphs etc) in OpenXML is organised in paragraphs.
-## Example
+!> Paragraphs requires an understanding of [Sections](usage/sections.md).
-You can add more text to the paragraph by doing this:
+You can create `Paragraphs` in the following ways:
-```js
-var paragraph = new docx.Paragraph(),
+### Shorthand
+
+```ts
+import { Paragraph } from "docx";
+
+const paragraph = new Paragraph("Short hand Hello World");
```
-```js
-var text = new docx.TextRun("Lorem Ipsum Foo Bar");
-var paragraph = new docx.Paragraph();
-paragraph.addRun(text);
+### Children Method
+
+This method is useful for adding different `text` with different styles or adding `images` inline.
+
+```ts
+const paragraph = new Paragraph({
+ children: [new TextRun("Lorem Ipsum Foo Bar"), new TextRun("Hello World")],
+});
```
-```js
-var paragraph = new docx.Paragraph("Short hand notation for adding text.");
+### Explicit
+
+```ts
+const paragraph = new Paragraph({
+ text: "Short hand notation for adding text.",
+});
```
-After you create the paragraph, you must add the paragraph into the `document`:
+After you create the paragraph, you must add the paragraph into the `document's section`. Learn more about `sections` here:
-```js
-doc.addParagraph(paragraph);
+```ts
+doc.addSection({
+ children: [paragraph],
+});
+```
+
+Or the preferred convension, define the paragraph inside the section and remove the usage of variables:
+
+```ts
+doc.addSection({
+ children: [
+ new Paragraph({
+ children: [new TextRun("Lorem Ipsum Foo Bar"), new TextRun("Hello World")],
+ }),
+ ],
+});
+```
+
+## Options
+
+This is the list of options for a paragraph. A detailed explanation is below:
+
+| Property | Type | Mandatory? | Possible Values |
+| ----------------------------- | ------------------------------------------------------------------------------------------------------------------- | ---------- | ---------------------------------------------------------------------------------------------------------- |
+| [text](#text) | `string` | Optional | |
+| [heading](#heading) | `HeadingLevel` | Optional | `HEADING_1`, `HEADING_2`, `HEADING_3`, `HEADING_4`, `HEADING_5`, `HEADING_6`, `TITLE` |
+| [border](#border) | `IBorderOptions` | Optional | `top`, `bottom`, `left`, `right`. Each of these are of type IBorderPropertyOptions. Click here for Example |
+| [spacing](#spacing) | `ISpacingProperties` | Optional | See below for ISpacingProperties |
+| [outlineLevel](#outline-level) | `number` | Optional | |
+| alignment | `AlignmentType` | Optional | |
+| heading | `HeadingLevel` | Optional | |
+| bidirectional | `boolean` | Optional | |
+| thematicBreak | `boolean` | Optional | |
+| pageBreakBefore | `boolean` | Optional | |
+| contextualSpacing | `boolean` | Optional | |
+| indent | `IIndentAttributesProperties` | Optional | |
+| keepLines | `boolean` | Optional | |
+| keepNext | `boolean` | Optional | |
+| children | `(TextRun or PictureRun or Hyperlink)[]` | Optional | |
+| style | `string` | Optional | |
+| tabStop | `{ left?: ITabStopOptions; right?: ITabStopOptions; maxRight?: { leader: LeaderType; }; center?: ITabStopOptions }` | Optional | |
+| bullet | `{ level: number }` | Optional | |
+| numbering | `{ num: Num; level: number; custom?: boolean }` | Optional | |
+
+## Text
+
+This is the text in a paragraph. You can also add text by using the `Paragraph` shorthand (mentioned above) or adding `children`.
+
+**Example:**
+
+```ts
+const paragraph = new Paragraph({
+ text: "Hello World",
+});
+```
+
+## Heading
+
+**Example:**
+
+Setting a Heading 1 paragraph with "Hello World" as it's text:
+
+```ts
+const paragraph = new Paragraph({
+ text: "Hello World",
+ heading: HeadingLevel.HEADING_1,
+});
+```
+
+## Border
+
+Add borders to a `Paragraph`. Good for making the `Paragraph` stand out
+
+#### IBorderPropertyOptions
+
+`top`, `bottom`, `left`, `right` of the border
+
+| Property | Type | Notes |
+| -------- | -------- | -------- |
+| color | `string` | Required |
+| space | `number` | Required |
+| value | `string` | Required |
+| size | `number` | Required |
+
+**Example:**
+
+Add border on the top and the bottom of the paragraph
+
+```ts
+const paragraph = new Paragraph({
+ text: "I have borders on my top and bottom sides!",
+ border: {
+ top: {
+ color: "auto",
+ space: 1,
+ value: "single",
+ size: 6,
+ },
+ bottom: {
+ color: "auto",
+ space: 1,
+ value: "single",
+ size: 6,
+ },
+ },
+});
+```
+
+## Spacing
+
+Adding spacing between paragraphs
+
+### ISpacingProperties
+
+| Property | Type | Notes |
+| -------- | -------- | -------- |
+| after | `number` | Optional |
+| before | `number` | Optional |
+| line | `number` | Optional |
+| lineRule | `string` | Optional |
+
+**Example:**
+
+Add spacing before the paragraph:
+
+```ts
+const paragraph = new Paragraph({
+ text: "Paragraph with spacing before",
+ spacing: {
+ before: 200,
+ },
+});
+```
+
+## Outline Level
+
+**Example:**
+
+```ts
+const paragraph = new Paragraph({
+ outlineLevel: 0,
+});
```
## Styles
@@ -32,46 +184,29 @@ To create styles, please refer to the styling Wiki: https://github.com/dolanmiu/

-### Heading1 - Heading5
+### Headings and titles
-```js
-paragraph.heading1();
-paragraph.heading2();
-paragraph.heading3();
-paragraph.heading4();
-paragraph.heading5();
-```
+```ts
+import { HeadingLevel, Paragraph } from "docx";
-### Title
-
-```js
-paragraph.title();
+const paragraph = new Paragraph({
+ text: "Hello World",
+ heading: HeadingLevel.TITLE,
+});
```
## Text Alignment
-To change the text alignment of a paragraph, for center, left, right or justified:
+To change the text alignment of a paragraph, add an `AlignmentType` option on the paragraph.for center, left, right or justified:
-```js
-paragraph.center();
-```
+**Example:**
-```js
-paragraph.left();
-```
-
-```js
-paragraph.right();
-```
-
-```js
-paragraph.justified();
-```
-
-### Example
-
-```js
-paragraph.heading1().center();
+```ts
+const paragraph = new Paragraph({
+ text: "Hello World",
+ heading: HeadingLevel.HEADING_1,
+ alignment: AlignmentType.CENTER,
+});
```
The above will create a `heading 1` which is `centered`.
@@ -94,10 +229,15 @@ The result is:
## Thematic Break
-To add a break in the page, simply add `.thematicBreak()` on a paragraph:
+To add a thematic break in the `Paragraph`:
-```js
-var paragraph = new docx.Paragraph("Amazing Heading").heading1().thematicBreak();
+```ts
+const paragraph = new docx.Paragraph("Amazing Heading");
+const paragraph = new Paragraph({
+ text: "Amazing Heading",
+ heading: HeadingLevel.HEADING_1,
+ thematicBreak: true,
+});
```
The above example will create a heading with a page break directly under it.
@@ -106,8 +246,8 @@ The above example will create a heading with a page break directly under it.
To move to a new page (insert a page break), simply add `.pageBreak()` on a paragraph:
-```js
-var paragraph = new docx.Paragraph("Amazing Heading").heading1().pageBreak();
+```ts
+const paragraph = new docx.Paragraph("Amazing Heading").pageBreak();
```
The above example will create a heading and start a new page immediately afterwards.
@@ -116,8 +256,11 @@ The above example will create a heading and start a new page immediately afterwa
This option (available in word) will make sure that the paragraph will start on a new page (if it's not already on a new page).
-```js
-var paragraph = new docx.Paragraph("Hello World on another page").pageBreakBefore();
+```ts
+const paragraph = new Paragraph({
+ text: "Hello World on another page",
+ pageBreakBefore: true,
+});
```

diff --git a/usage/sections.md b/usage/sections.md
new file mode 100644
index 0000000000..5b6d4e9c74
--- /dev/null
+++ b/usage/sections.md
@@ -0,0 +1,21 @@
+# Sections
+
+> Every document is made up of one or more sections
+
+A section is a grouping of paragraphs that have a specific set of properties used to define the pages on which the text will appear. Properties include page size, page numbers, page orientation, headers, borders and margins.
+
+For example, you could have one section which is portrait with a header and footer, and another section in landscape with no footer, and a header showing the current page number.
+
+## Example
+
+This creates a simple section in a document with one paragraph inside:
+
+```ts
+doc.addSection({
+ children: [
+ new Paragraph({
+ children: [new TextRun("Hello World")],
+ }),
+ ],
+});
+```
diff --git a/usage/styling-with-js.md b/usage/styling-with-js.md
index f1f043cb1b..74fcdffb93 100644
--- a/usage/styling-with-js.md
+++ b/usage/styling-with-js.md
@@ -2,7 +2,7 @@
## Example
-```js
+```ts
const para = new Paragraph("To whom it may concern:").heading2().center();
const name = new TextRun("Name:")
@@ -56,7 +56,7 @@ Unlike CSS, less specific rules don't _necessarily_ override parent rules. The r
This is the type of formatting that your uncle uses when he types out documents: _N ... a ... m ... e ... :_ Then he grabs the mouse, highlights _Name:_ and moves over to the **B** for bold. This manner of formatting results in markup that is similar to writing `Name:` if you were typing out HTML. DOCX (the format) allows you to specify this for any of the four types of items. `docx` (the library) only supports this type of formatting for paragraphs and characters, using a _fluent_ api. Thus you could do:
-```js
+```ts
const name = new TextRun("Name:")
.bold()
.font("Calibri")
@@ -65,7 +65,7 @@ const name = new TextRun("Name:")
Or for paragraph formatting:
-```js
+```ts
const para = new Paragraph("To whom it may concern:").heading2().center();
```
@@ -76,12 +76,12 @@ DOCX files contain a styles section separate from the main content, much like ho
There are three parts to using custom styles with `docx`:
1. Create a container object for the style definitions:
- ```js
+ ```ts
const myStyles = new docx.Styles();
```
2. Define your custom styles, similar to the way you would format a paragraph or run
- ```js
+ ```ts
// The first argument is an ID you use to apply the style to paragraphs
// The second argument is a human-friendly name to show in the UI
myStyles
@@ -106,7 +106,7 @@ There are three parts to using custom styles with `docx`:
3. When you generate your document, make sure to pass the `styles` container to the `Packer`:
- ```js
+ ```ts
const packer = new Packer(doc, myStyles);
packer.pack(myOutStream);
```
diff --git a/usage/styling-with-xml.md b/usage/styling-with-xml.md
index 5f138d31d6..ee5a2b1db4 100644
--- a/usage/styling-with-xml.md
+++ b/usage/styling-with-xml.md
@@ -24,7 +24,7 @@
Read the styles using `fs`, and put it into the `Document` object in the constructor:
-```js
+```ts
const styles = fs.readFileSync("./styles.xml", "utf-8");
const doc = new docx.Document({
title: "Title",
@@ -34,12 +34,12 @@ const doc = new docx.Document({
You can use paragraphs, `heading1()`, `heading2()` etc and it will be styled according to your `styles.xml` created earlier. You can even use your new style you made by calling the `style` method:
-```js
+```ts
doc.createParagraph("Cool Heading Text").heading1();
-let paragraph = new docx.Paragraph('This is a custom named style from the template "Cool New Style"');
+const paragraph = new docx.Paragraph('This is a custom named style from the template "Cool New Style"');
paragraph.style("Cool New Style");
-doc.addParagraph(paragraph);
+doc.add(paragraph);
doc.createParagraph("Some normal text");
```
diff --git a/usage/tab-stops.md b/usage/tab-stops.md
index aa15ea75a9..e172c7f9b0 100644
--- a/usage/tab-stops.md
+++ b/usage/tab-stops.md
@@ -10,45 +10,45 @@ Simply call the relevant methods on the paragraph listed below. Then just add a
## Example
-```js
-var paragraph = new docx.Paragraph().maxRightTabStop();
-var leftText = new docx.TextRun("Hey everyone").bold();
-var rightText = new docx.TextRun("11th November 2015").tab();
+```ts
+const paragraph = new docx.Paragraph().maxRightTabStop();
+const leftText = new docx.TextRun("Hey everyone").bold();
+const rightText = new docx.TextRun("11th November 2015").tab();
paragraph.addRun(leftText);
paragraph.addRun(rightText);
```
The example above will create a left aligned text, and a right aligned text on the same line. The laymans approach to this problem would be to either use text boxes or tables. YUK!
-```js
-var paragraph = new docx.Paragraph();
+```ts
+const paragraph = new docx.Paragraph();
paragraph.maxRightTabStop();
paragraph.leftTabStop(1000);
-var text = new docx.TextRun("Second tab stop here I come!").tab().tab();
+const text = new docx.TextRun("Second tab stop here I come!").tab().tab();
paragraph.addRun(text);
```
The above shows the use of two tab stops, and how to select/use it.
## Left Tab Stop
-```js
+```ts
paragraph.leftTabStop(2268);
```
2268 is the distance from the left side.
## Center Tab Stop
-```js
+```ts
paragraph.centerTabStop(2268);
```
2268 is the distance from the left side.
## Right Tab Stop
-```js
+```ts
paragraph.rightTabStop(2268);
```
2268 is the distance from the left side.
## Max Right Tab Stop
-```js
+```ts
paragraph.maxRightTabStop();
```
This will create a tab stop on the very edge of the right hand side. Handy for right aligning and left aligning text on the same line.
diff --git a/usage/table-of-contents.md b/usage/table-of-contents.md
index c1fb439143..53e8e7df57 100644
--- a/usage/table-of-contents.md
+++ b/usage/table-of-contents.md
@@ -12,7 +12,7 @@ The complete documentation can be found [here](https://www.ecma-international.or
All you need to do is create a `TableOfContents` object and assign it to the document.
-```js
+```ts
const toc = new TableOfContents("Summary", {
hyperlink: true,
headingStyleRange: "1-5",
@@ -47,7 +47,7 @@ Here is the list of all options that you can use to generate your tables of cont
## Examples
-```js
+```ts
// Let's define the options for generate a TOC for heading 1-5 and MySpectacularStyle,
// making the entries be hyperlinks for the paragraph
const toc = new TableOfContents("Summary", {
@@ -58,15 +58,15 @@ const toc = new TableOfContents("Summary", {
doc.addTableOfContents(toc);
-doc.addParagraph(new Paragraph("Header #1").heading1().pageBreakBefore());
-doc.addParagraph(new Paragraph("I'm a little text, very nicely written.'"));
+doc.add(new Paragraph("Header #1").heading1().pageBreakBefore());
+doc.add(new Paragraph("I'm a little text, very nicely written.'"));
-doc.addParagraph(new Paragraph("Header #2").heading1().pageBreakBefore());
-doc.addParagraph(new Paragraph("I'm another text very nicely written.'"));
-doc.addParagraph(new Paragraph("Header #2.1").heading2());
-doc.addParagraph(new Paragraph("I'm another text very nicely written.'"));
+doc.add(new Paragraph("Header #2").heading1().pageBreakBefore());
+doc.add(new Paragraph("I'm another text very nicely written.'"));
+doc.add(new Paragraph("Header #2.1").heading2());
+doc.add(new Paragraph("I'm another text very nicely written.'"));
-doc.addParagraph(new Paragraph("My Spectacular Style #1").style("MySpectacularStyle").pageBreakBefore());
+doc.add(new Paragraph("My Spectacular Style #1").style("MySpectacularStyle").pageBreakBefore());
```
### Complete example
diff --git a/usage/tables.md b/usage/tables.md
index ed669cfd18..70556ae028 100644
--- a/usage/tables.md
+++ b/usage/tables.md
@@ -4,28 +4,30 @@ You can create tables with `docx`. More information can be found [here](http://o
## Create Table
-To create a table, simply use the `createTable()` method on a `document`.
+To create a table, simply create one with `new Table()`, then add it to the document: `doc.add()`.
```ts
-const table = doc.createTable([NUMBER OF ROWS], [NUMBER OF COLUMNS]);
+const table = doc.add(new Table({
+ rows: [NUMBER OF ROWS],
+ columns: [NUMBER OF COLUMNS]
+});
```
Alternatively, you can create a table object directly, and then add it in the `document`
```ts
const table = new Table(4, 4);
-doc.addTable(table);
+doc.add(table);
```
The snippet below creates a table of 2 rows and 4 columns.
```ts
-const table = doc.createTable(2, 4);
-
-// Or
-
-const table = new Table(2, 4);
-doc.addTable(table);
+const table = new Table({
+ rows: 2,
+ columns: 4,
+});
+doc.add(table);
```
## Rows and Columns
@@ -70,7 +72,7 @@ column.getCell(index);
## Cells
-The `createTable()` method created a table with cells. To access the cell, use the `getCell()` method.
+To access the cell, use the `getCell()` method.
```ts
const cell = table.getCell([ROW INDEX], [COLUMN INDEX]);
@@ -90,10 +92,10 @@ const cell = column.getCell(2);
### Add paragraph to a cell
-Once you have got the cell, you can add data to it with the `addParagraph()` method.
+Once you have got the cell, you can add data to it with the `add()` method.
```ts
-cell.addParagraph(new Paragraph("Hello"));
+cell.add(new Paragraph("Hello"));
```
### Set width of a cell
@@ -103,10 +105,11 @@ You can specify the width of a cell using:
`cell.Properties.setWidth(width, format)`
format can be:
-* WidthType.AUTO
-* WidthType.DXA: value is in twentieths of a point
-* WidthType.NIL: is considered as zero
-* WidthType.PCT: percent of table width
+
+- WidthType.AUTO
+- WidthType.DXA: value is in twentieths of a point
+- WidthType.NIL: is considered as zero
+- WidthType.PCT: percent of table width
### Example
@@ -115,7 +118,7 @@ cell.Properties.setWidth(100, WidthType.DXA);
```
```ts
-cell.Properties.setWidth('50%', WidthType.PCT);
+cell.Properties.setWidth("50%", WidthType.PCT);
```
## Borders
@@ -223,7 +226,7 @@ It has not been implemented yet, but it will follow a similar structure as mergi
To have a table within a table
```ts
-cell.addTable(new Table(1, 1));
+cell.add(new Table(1, 1));
```
## Pagination
@@ -241,11 +244,10 @@ If a table is paginated on multiple pages, it is possible to repeat a row at the
```ts
table.getRow(0).setTableHeader();
```
-
## Examples
-[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo4.ts ':include')
+[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo4.ts ":include")
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo4.ts_
@@ -253,7 +255,7 @@ _Source: https://github.com/dolanmiu/docx/blob/master/demo/demo4.ts_
Example showing how to add colourful borders to tables
-[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo20.ts ':include')
+[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo20.ts ":include")
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo20.ts_
@@ -261,11 +263,11 @@ _Source: https://github.com/dolanmiu/docx/blob/master/demo/demo20.ts_
Example showing how to add images to tables
-[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo24.ts ':include')
+[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo24.ts ":include")
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo24.ts_
-[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo36.ts ':include')
+[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo36.ts ":include")
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo36.ts_
@@ -273,7 +275,7 @@ _Source: https://github.com/dolanmiu/docx/blob/master/demo/demo36.ts_
Example showing how align text in a table cell
-[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo31.ts ':include')
+[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo31.ts ":include")
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo31.ts_
@@ -281,11 +283,11 @@ _Source: https://github.com/dolanmiu/docx/blob/master/demo/demo31.ts_
Example showing merging of `rows`
-[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo32.ts ':include')
+[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo32.ts ":include")
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo32.ts_
-[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo41.ts ':include')
+[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo41.ts ":include")
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo41.ts_
@@ -293,13 +295,12 @@ _Source: https://github.com/dolanmiu/docx/blob/master/demo/demo41.ts_
Example showing merging of `columns`
-[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo43.ts ':include')
+[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo43.ts ":include")
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo43.ts_
### Floating tables
-[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo34.ts ':include')
+[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo34.ts ":include")
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo34.ts_
-
diff --git a/usage/text.md b/usage/text.md
index faa2bdf2d5..6cbd9da224 100644
--- a/usage/text.md
+++ b/usage/text.md
@@ -1,10 +1,15 @@
-# Text
+# Text Runs
-Paragraphs need `text run` objects. To create text:
+!> TextRuns requires an understanding of [Paragraphs](usage/paragraph.md).
-```js
-var text = new docx.TextRun("My awesome text here for my university dissertation");
-paragraph.addRun(text);
+You can add multiple `text runs` in `Paragraphs`. This is the most verbose way of writing a `Paragraph` but it is also the most flexible:
+
+```ts
+import { Paragraph, TextRun } from "docx";
+
+const paragraph = new Paragraph({
+ children: [new TextRun("My awesome text here for my university dissertation"), new TextRun("Foo Bar")],
+});
```
Text objects have methods inside which changes the way the text is displayed.
@@ -15,55 +20,87 @@ More info [here](https://english.stackexchange.com/questions/97081/what-is-the-t
### Bold
-```js
-text.bold();
+```ts
+const text = new TextRun({
+ text: "Foo Bar",
+ bold: true,
+});
```
### Italics
-```js
-text.italics();
+```ts
+const text = new TextRun({
+ text: "Foo Bar",
+ italics: true,
+});
```
### Underline
-```js
-text.underline();
+Underline has a few options
+
+#### Options
+
+| Property | Type | Notes | Possible Values |
+| -------- | --------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| type | `UnderlineType` | Optional | SINGLE, WORD, DOUBLE, THICK, DOTTED, DOTTEDHEAV, DASH, DASHEDHEAV, DASHLONG, DASHLONGHEAV, DOTDASH, DASHDOTHEAVY, DOTDOTDAS, DASHDOTDOTHEAVY, WAVE, WAVYHEAVY, WAVYDOUBLE |
+| color | `string` | Optional | Color Hex values |
+
+**Example:**
+
+```ts
+const text = new TextRun({
+ text: "and then underlined ",
+ underline: {
+ type: UnderlineType.DOUBLE,
+ color: "990011",
+ },
+});
+```
+
+To do a simple vanilla underline:
+
+```ts
+const text = new TextRun({
+ text: "and then underlined ",
+ underline: {},
+});
```
### Strike through
-```js
+```ts
text.strike();
```
### Double strike through
-```js
+```ts
text.doubleStrike();
```
### Superscript
-```js
+```ts
text.superScript();
```
### Subscript
-```js
+```ts
text.subScript();
```
### All Capitals
-```js
+```ts
text.allCaps();
```
### Small Capitals
-```js
+```ts
text.smallCaps();
```
@@ -71,7 +108,7 @@ text.smallCaps();
Sometimes you would want to put text underneath another line of text but inside the same paragraph.
-```js
+```ts
text.break();
```
@@ -79,6 +116,6 @@ text.break();
What if you want to create a paragraph which is **_bold_** and **_italic_**?
-```js
+```ts
paragraph.bold().italics();
```
Parameters
section: SectionPropertiesOptions | SectionProperties
+options: SectionPropertiesOptions
new section
+new section options
Returns void
-getParagraphs
--- get
Paragraphs(): Paragraph[]
-
---
-
-
-
-Returns Paragraph[]
-getTablesOfContents
@@ -282,7 +240,7 @@Returns TableOfContents[]
@@ -300,7 +258,7 @@Returns IXmlableObject @@ -320,7 +278,7 @@
Parameters
@@ -353,9 +311,6 @@Returns Bold
@@ -138,7 +138,7 @@Returns boolean
@@ -159,7 +159,7 @@Parameters
@@ -183,7 +183,7 @@Returns void
@@ -202,7 +202,7 @@Inherited from XmlComponent.prepForXml
Overrides BaseXmlComponent.prepForXml
-- Defined in file/xml-components/xml-component.ts:16
+ - Defined in file/xml-components/xml-component.ts:16
Returns IXmlableObject diff --git a/api/classes/boldcomplexscript.html b/api/classes/boldcomplexscript.html index 0db4929855..744413762d 100644 --- a/api/classes/boldcomplexscript.html +++ b/api/classes/boldcomplexscript.html @@ -117,7 +117,7 @@
Returns BoldComplexScript
@@ -138,7 +138,7 @@Returns boolean
@@ -159,7 +159,7 @@Parameters
@@ -183,7 +183,7 @@Returns void
@@ -202,7 +202,7 @@Inherited from XmlComponent.prepForXml
Overrides BaseXmlComponent.prepForXml
-- Defined in file/xml-components/xml-component.ts:16
+ - Defined in file/xml-components/xml-component.ts:16
Returns IXmlableObject diff --git a/api/classes/bookmark.html b/api/classes/bookmark.html index 513e84f7f5..961ba1d026 100644 --- a/api/classes/bookmark.html +++ b/api/classes/bookmark.html @@ -106,7 +106,7 @@
Parameters
@@ -134,7 +134,7 @@Parameters
@@ -145,7 +145,7 @@Returns boolean
@@ -184,7 +184,7 @@Parameters
@@ -208,7 +208,7 @@Returns void
@@ -227,7 +227,7 @@Inherited from XmlComponent.prepForXml
Overrides BaseXmlComponent.prepForXml
-- Defined in file/xml-components/xml-component.ts:16
+ - Defined in file/xml-components/xml-component.ts:16
Returns IXmlableObject diff --git a/api/classes/bookmarkendattributes.html b/api/classes/bookmarkendattributes.html index e3ac6dfec2..d95a7df686 100644 --- a/api/classes/bookmarkendattributes.html +++ b/api/classes/bookmarkendattributes.html @@ -117,7 +117,7 @@
Inherited from XmlAttributeComponent.constructor
Overrides BaseXmlComponent.constructor
-- Defined in file/xml-components/default-attributes.ts:9
+ - Defined in file/xml-components/default-attributes.ts:9
Parameters
@@ -144,7 +144,7 @@Returns boolean
@@ -166,7 +166,7 @@Inherited from XmlAttributeComponent.prepForXml
Overrides BaseXmlComponent.prepForXml
-- Defined in file/xml-components/default-attributes.ts:16
+ - Defined in file/xml-components/default-attributes.ts:16
Returns IXmlableObject
@@ -184,7 +184,7 @@Parameters
diff --git a/api/classes/bookmarkstart.html b/api/classes/bookmarkstart.html index 8becc23d86..8c090bc525 100644 --- a/api/classes/bookmarkstart.html +++ b/api/classes/bookmarkstart.html @@ -123,7 +123,7 @@Parameters
@@ -148,7 +148,7 @@Returns boolean
@@ -187,7 +187,7 @@Parameters
@@ -211,7 +211,7 @@Returns void
@@ -230,7 +230,7 @@Inherited from XmlComponent.prepForXml
Overrides BaseXmlComponent.prepForXml
-- Defined in file/xml-components/xml-component.ts:16
+ - Defined in file/xml-components/xml-component.ts:16
Returns IXmlableObject diff --git a/api/classes/bookmarkstartattributes.html b/api/classes/bookmarkstartattributes.html index 6d1d63ade5..6dd72bf02f 100644 --- a/api/classes/bookmarkstartattributes.html +++ b/api/classes/bookmarkstartattributes.html @@ -117,7 +117,7 @@
Inherited from XmlAttributeComponent.constructor
Overrides BaseXmlComponent.constructor
-- Defined in file/xml-components/default-attributes.ts:9
+ - Defined in file/xml-components/default-attributes.ts:9
Parameters
@@ -144,7 +144,7 @@Returns boolean
@@ -166,7 +166,7 @@Inherited from XmlAttributeComponent.prepForXml
Overrides BaseXmlComponent.prepForXml
-- Defined in file/xml-components/default-attributes.ts:16
+ - Defined in file/xml-components/default-attributes.ts:16
Returns IXmlableObject
@@ -184,7 +184,7 @@Parameters
diff --git a/api/classes/border.html b/api/classes/border.html index 5754cfeb93..f334da7424 100644 --- a/api/classes/border.html +++ b/api/classes/border.html @@ -93,14 +93,10 @@Methods
-- add
BottomBorder
- add
ChildElement
- - add
LeftBorder
- - add
RightBorder
- - add
TopBorder
- delete
- prep
ForXml
@@ -114,16 +110,22 @@constructor
-- new
Border(): Border
+ - new
Border(options: IBorderOptions): Border
Parameters
++-
+
+
options: IBorderOptions
+Returns Border
Returns boolean
@@ -150,40 +152,8 @@Methods
-addBottomBorder
--- add
BottomBorder(color?: string, space?: string, value?: string, size?: string): XmlComponent
-
---
-
-
-
-Parameters
---
-
- -
-
- -
-
- -
-
-
-Default value color: string = "auto"
-Default value space: string = "1"
-Default value value: string = "single"
-Default value size: string = "6"
-Returns XmlComponent
-addChildElement
@@ -195,7 +165,7 @@Parameters
@@ -208,102 +178,6 @@addLeftBorder
--- add
LeftBorder(color?: string, space?: string, value?: string, size?: string): XmlComponent
-
---
-
-
-
-Parameters
---
-
- -
-
- -
-
- -
-
-
-Default value color: string = "auto"
-Default value space: string = "1"
-Default value value: string = "single"
-Default value size: string = "6"
-Returns XmlComponent
-addRightBorder
--- add
RightBorder(color?: string, space?: string, value?: string, size?: string): XmlComponent
-
---
-
-
-
-Parameters
---
-
- -
-
- -
-
- -
-
-
-Default value color: string = "auto"
-Default value space: string = "1"
-Default value value: string = "single"
-Default value size: string = "6"
-Returns XmlComponent
-addTopBorder
--- add
TopBorder(color?: string, space?: string, value?: string, size?: string): XmlComponent
-
---
-
-
-
-Parameters
---
-
- -
-
- -
-
- -
-
-
-Default value color: string = "auto"
-Default value space: string = "1"
-Default value value: string = "single"
-Default value size: string = "6"
-Returns XmlComponent
-delete
@@ -315,7 +189,7 @@Returns void
@@ -334,7 +208,7 @@Inherited from XmlComponent.prepForXml
Overrides BaseXmlComponent.prepForXml
-- Defined in file/xml-components/xml-component.ts:16
+ - Defined in file/xml-components/xml-component.ts:16
Returns IXmlableObject @@ -367,21 +241,9 @@
+- Preparing search index...
+ - The search index is not available
+
+ docx ++- Public
+ - Public/Protected
+ - All
+
++-
+ Globals
+
+ -
+ BorderAttributes
+
+
+Class BorderAttributes
+Hierarchy
++-
+ XmlAttributeComponent<IBorderAttributesProperties>
+
+
++-
+ BorderAttributes
+
+
+Index
+Constructors
++- constructor
+
+Accessors
++- Is
Deleted
+
+Methods
++- prep
ForXml
+ - set
+
+Constructors
+constructor
++- new
BorderAttributes(properties: IBorderAttributesProperties): BorderAttributes
+
++-
+
+
+
+Parameters
++-
+
+
+properties: IBorderAttributesProperties
+Returns BorderAttributes
+Accessors
+IsDeleted
++- get IsDeleted(): boolean
+
++-
+
+
+
+Returns boolean
+Methods
+prepForXml
++- prep
ForXml(): IXmlableObject
+
++-
+
+
+
+Returns IXmlableObject
+set
++- set(properties: IBorderAttributesProperties): void
+
++-
+
+
+
+Parameters
++-
+
+
+properties: IBorderAttributesProperties
+Returns void
+Generated using TypeDoc
+Parameters
@@ -144,7 +144,7 @@Returns boolean
@@ -165,7 +165,7 @@Parameters
@@ -189,7 +189,7 @@Returns void
@@ -208,7 +208,7 @@Inherited from XmlComponent.prepForXml
Overrides BaseXmlComponent.prepForXml
-- Defined in file/xml-components/xml-component.ts:16
+ - Defined in file/xml-components/xml-component.ts:16
Returns IXmlableObject diff --git a/api/classes/break.html b/api/classes/break.html index 5249191ab1..fd3a62151c 100644 --- a/api/classes/break.html +++ b/api/classes/break.html @@ -117,7 +117,7 @@
Returns Break
@@ -138,7 +138,7 @@Returns boolean
@@ -159,7 +159,7 @@Parameters
@@ -183,7 +183,7 @@Returns void
@@ -202,7 +202,7 @@Inherited from XmlComponent.prepForXml
Overrides BaseXmlComponent.prepForXml
-- Defined in file/xml-components/xml-component.ts:16
+ - Defined in file/xml-components/xml-component.ts:16
Returns IXmlableObject diff --git a/api/classes/cantsplit.html b/api/classes/cantsplit.html index 005bed60f4..fa3b0644f6 100644 --- a/api/classes/cantsplit.html +++ b/api/classes/cantsplit.html @@ -117,7 +117,7 @@
Returns CantSplit
@@ -138,7 +138,7 @@Returns boolean
@@ -159,7 +159,7 @@Parameters
@@ -183,7 +183,7 @@Returns void
@@ -202,7 +202,7 @@Inherited from XmlComponent.prepForXml
Overrides BaseXmlComponent.prepForXml
-- Defined in file/xml-components/xml-component.ts:16
+ - Defined in file/xml-components/xml-component.ts:16
Returns IXmlableObject diff --git a/api/classes/caps.html b/api/classes/caps.html index 42fc5bda1f..e335e38dca 100644 --- a/api/classes/caps.html +++ b/api/classes/caps.html @@ -120,7 +120,7 @@
Returns Caps
@@ -142,7 +142,7 @@Inherited from BaseXmlComponent.IsDeleted
Overrides BaseXmlComponent.IsDeleted
-- Defined in file/xml-components/base.ts:14
+ - Defined in file/xml-components/base.ts:14
Returns boolean
@@ -164,7 +164,7 @@Inherited from XmlComponent.addChildElement
Overrides XmlComponent.addChildElement
-- Defined in file/xml-components/xml-component.ts:43
+ - Defined in file/xml-components/xml-component.ts:43
Parameters
@@ -189,7 +189,7 @@Inherited from XmlComponent.delete
Overrides XmlComponent.delete
-- Defined in file/xml-components/xml-component.ts:49
+ - Defined in file/xml-components/xml-component.ts:49
Returns void
@@ -208,7 +208,7 @@Inherited from XmlComponent.prepForXml
Overrides BaseXmlComponent.prepForXml
-- Defined in file/xml-components/xml-component.ts:16
+ - Defined in file/xml-components/xml-component.ts:16
Returns IXmlableObject diff --git a/api/classes/centertabstop.html b/api/classes/centertabstop.html index fbbbfb05ad..3fedfac18d 100644 --- a/api/classes/centertabstop.html +++ b/api/classes/centertabstop.html @@ -117,7 +117,7 @@
Parameters
@@ -147,7 +147,7 @@Returns boolean
@@ -168,7 +168,7 @@Parameters
@@ -192,7 +192,7 @@Returns void
@@ -211,7 +211,7 @@Inherited from XmlComponent.prepForXml
Overrides BaseXmlComponent.prepForXml
-- Defined in file/xml-components/xml-component.ts:16
+ - Defined in file/xml-components/xml-component.ts:16
Returns IXmlableObject diff --git a/api/classes/characterspacing.html b/api/classes/characterspacing.html index 5387a2224d..a3fa99a9ce 100644 --- a/api/classes/characterspacing.html +++ b/api/classes/characterspacing.html @@ -117,7 +117,7 @@
Parameters
@@ -144,7 +144,7 @@Returns boolean
@@ -165,7 +165,7 @@Parameters
@@ -189,7 +189,7 @@Returns void
@@ -208,7 +208,7 @@Inherited from XmlComponent.prepForXml
Overrides BaseXmlComponent.prepForXml
-- Defined in file/xml-components/xml-component.ts:16
+ - Defined in file/xml-components/xml-component.ts:16
Returns IXmlableObject diff --git a/api/classes/characterstyle.html b/api/classes/characterstyle.html index 615208c80b..6b64cad2fe 100644 --- a/api/classes/characterstyle.html +++ b/api/classes/characterstyle.html @@ -68,7 +68,7 @@-
- Style
+ Style
-
CharacterStyle
@@ -139,9 +139,9 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Hierarchy
Parameters
@@ -171,7 +171,7 @@Returns boolean
@@ -192,7 +192,7 @@Parameters
@@ -215,7 +215,7 @@Parameters
@@ -238,7 +238,7 @@Parameters
@@ -261,7 +261,7 @@Returns CharacterStyle
@@ -278,7 +278,7 @@Parameters
@@ -302,7 +302,7 @@Returns void
@@ -319,7 +319,7 @@Parameters
@@ -342,7 +342,7 @@Returns CharacterStyle
@@ -359,7 +359,7 @@Parameters
@@ -384,7 +384,7 @@Inherited from XmlComponent.prepForXml
Overrides BaseXmlComponent.prepForXml
-- Defined in file/xml-components/xml-component.ts:16
+ - Defined in file/xml-components/xml-component.ts:16
Returns IXmlableObject @@ -405,7 +405,7 @@
Parameters
@@ -428,7 +428,7 @@Returns CharacterStyle
@@ -445,7 +445,7 @@Parameters
@@ -474,7 +474,7 @@Parameters
@@ -497,7 +497,7 @@Returns CharacterStyle
@@ -514,7 +514,7 @@Parameters
diff --git a/api/classes/childnonvisualproperties.html b/api/classes/childnonvisualproperties.html index a7dcf06461..9fd9ac3647 100644 --- a/api/classes/childnonvisualproperties.html +++ b/api/classes/childnonvisualproperties.html @@ -117,7 +117,7 @@Returns ChildNonVisualProperties
@@ -138,7 +138,7 @@Returns boolean
@@ -159,7 +159,7 @@Parameters
@@ -183,7 +183,7 @@Returns void
@@ -202,7 +202,7 @@Inherited from XmlComponent.prepForXml
Overrides BaseXmlComponent.prepForXml
-- Defined in file/xml-components/xml-component.ts:16
+ - Defined in file/xml-components/xml-component.ts:16
Returns IXmlableObject diff --git a/api/classes/color.html b/api/classes/color.html index 089cd688b3..b4804ecc19 100644 --- a/api/classes/color.html +++ b/api/classes/color.html @@ -117,7 +117,7 @@
Parameters
@@ -144,7 +144,7 @@Returns boolean
@@ -165,7 +165,7 @@Parameters
@@ -189,7 +189,7 @@Returns void
@@ -208,7 +208,7 @@Inherited from XmlComponent.prepForXml
Overrides BaseXmlComponent.prepForXml
-- Defined in file/xml-components/xml-component.ts:16
+ - Defined in file/xml-components/xml-component.ts:16
Returns IXmlableObject diff --git a/api/classes/columns.html b/api/classes/columns.html index 0f8b1c1aa2..311ba3eec3 100644 --- a/api/classes/columns.html +++ b/api/classes/columns.html @@ -117,7 +117,7 @@
Parameters
@@ -147,7 +147,7 @@Returns boolean
@@ -168,7 +168,7 @@Parameters
@@ -192,7 +192,7 @@Returns void
@@ -211,7 +211,7 @@Inherited from XmlComponent.prepForXml
Overrides BaseXmlComponent.prepForXml
-- Defined in file/xml-components/xml-component.ts:16
+ - Defined in file/xml-components/xml-component.ts:16
Returns IXmlableObject diff --git a/api/classes/columnsattributes.html b/api/classes/columnsattributes.html index da63d79c2e..2e6cd9aa8d 100644 --- a/api/classes/columnsattributes.html +++ b/api/classes/columnsattributes.html @@ -117,7 +117,7 @@
Inherited from XmlAttributeComponent.constructor
Overrides BaseXmlComponent.constructor
-- Defined in file/xml-components/default-attributes.ts:9
+ - Defined in file/xml-components/default-attributes.ts:9
Parameters
@@ -144,7 +144,7 @@Returns boolean
@@ -166,7 +166,7 @@Inherited from XmlAttributeComponent.prepForXml
Overrides BaseXmlComponent.prepForXml
-- Defined in file/xml-components/default-attributes.ts:16
+ - Defined in file/xml-components/default-attributes.ts:16
Returns IXmlableObject
@@ -184,7 +184,7 @@Parameters
diff --git a/api/classes/compatibility.html b/api/classes/compatibility.html index a1e9738fce..ce9754ed99 100644 --- a/api/classes/compatibility.html +++ b/api/classes/compatibility.html @@ -118,7 +118,7 @@Returns Compatibility
@@ -139,7 +139,7 @@Returns boolean
@@ -160,7 +160,7 @@Parameters
@@ -184,7 +184,7 @@Returns void
@@ -201,7 +201,7 @@Returns Compatibility
@@ -220,7 +220,7 @@Inherited from XmlComponent.prepForXml
Overrides BaseXmlComponent.prepForXml
-- Defined in file/xml-components/xml-component.ts:16
+ - Defined in file/xml-components/xml-component.ts:16
Returns IXmlableObject diff --git a/api/classes/compiler.html b/api/classes/compiler.html index 9a0b88d601..bd73eff3fc 100644 --- a/api/classes/compiler.html +++ b/api/classes/compiler.html @@ -103,7 +103,7 @@
Parameters
@@ -129,7 +129,7 @@Parameters
diff --git a/api/classes/contenttypeattributes.html b/api/classes/contenttypeattributes.html index b75b647d6d..1c9ce13ad1 100644 --- a/api/classes/contenttypeattributes.html +++ b/api/classes/contenttypeattributes.html @@ -117,7 +117,7 @@Inherited from XmlAttributeComponent.constructor
Overrides BaseXmlComponent.constructor
-- Defined in file/xml-components/default-attributes.ts:9
+ - Defined in file/xml-components/default-attributes.ts:9
Parameters
@@ -144,7 +144,7 @@Returns boolean
@@ -166,7 +166,7 @@Inherited from XmlAttributeComponent.prepForXml
Overrides BaseXmlComponent.prepForXml
-- Defined in file/xml-components/default-attributes.ts:16
+ - Defined in file/xml-components/default-attributes.ts:16
Returns IXmlableObject
@@ -184,7 +184,7 @@Parameters
diff --git a/api/classes/contenttypes.html b/api/classes/contenttypes.html index 8101459caf..550147710b 100644 --- a/api/classes/contenttypes.html +++ b/api/classes/contenttypes.html @@ -119,7 +119,7 @@Returns ContentTypes
@@ -140,7 +140,7 @@Returns boolean
@@ -161,7 +161,7 @@Parameters
@@ -184,7 +184,7 @@Parameters
@@ -207,7 +207,7 @@Parameters
@@ -231,7 +231,7 @@Returns void
@@ -250,7 +250,7 @@Inherited from XmlComponent.prepForXml
Overrides BaseXmlComponent.prepForXml
-- Defined in file/xml-components/xml-component.ts:16
+ - Defined in file/xml-components/xml-component.ts:16
Returns IXmlableObject diff --git a/api/classes/contextualspacing.html b/api/classes/contextualspacing.html index 5a740483cf..9872fc5a3e 100644 --- a/api/classes/contextualspacing.html +++ b/api/classes/contextualspacing.html @@ -117,7 +117,7 @@
Parameters
@@ -144,7 +144,7 @@Returns boolean
@@ -165,7 +165,7 @@Parameters
@@ -189,7 +189,7 @@Returns void
@@ -208,7 +208,7 @@Inherited from XmlComponent.prepForXml
Overrides BaseXmlComponent.prepForXml
-- Defined in file/xml-components/xml-component.ts:16
+ - Defined in file/xml-components/xml-component.ts:16
Returns IXmlableObject diff --git a/api/classes/continuationseperator.html b/api/classes/continuationseperator.html index 4a2925dd12..f78d693fff 100644 --- a/api/classes/continuationseperator.html +++ b/api/classes/continuationseperator.html @@ -117,7 +117,7 @@
Returns ContinuationSeperator
@@ -138,7 +138,7 @@Returns boolean
@@ -159,7 +159,7 @@Parameters
@@ -183,7 +183,7 @@Returns void
@@ -202,7 +202,7 @@Inherited from XmlComponent.prepForXml
Overrides BaseXmlComponent.prepForXml
-- Defined in file/xml-components/xml-component.ts:16
+ - Defined in file/xml-components/xml-component.ts:16
Returns IXmlableObject diff --git a/api/classes/continuationseperatorrun.html b/api/classes/continuationseperatorrun.html index 5dfec01104..f1a1f68bd4 100644 --- a/api/classes/continuationseperatorrun.html +++ b/api/classes/continuationseperatorrun.html @@ -97,28 +97,12 @@- add
ChildElement
- - all
Caps
- - bold
- break
- - color
- delete
- - double
Strike
- - font
- - highlight
- - italics
- number
OfTotalPages
- page
Number
- prep
ForXml
- - right
ToLeft
- - shadow
- - size
- - small
Caps
- - strike
- - style
- - sub
Script
- - super
Script
- tab
- - underline
Methods