Fix demo examples
This commit is contained in:
105
docs/examples.md
105
docs/examples.md
@ -14,9 +14,9 @@ This command will run the `demo selector app` in the `/demo` folder. It will pro
|
|||||||
|
|
||||||
A simple hello world of the `docx` library:
|
A simple hello world of the `docx` library:
|
||||||
|
|
||||||
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo1.js ":include")
|
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo1.ts ":include")
|
||||||
|
|
||||||
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo1.js_
|
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo1.ts_
|
||||||
|
|
||||||
## Styles
|
## Styles
|
||||||
|
|
||||||
@ -24,41 +24,41 @@ _Source: https://github.com/dolanmiu/docx/blob/master/demo/demo1.js_
|
|||||||
|
|
||||||
This example shows how to customise the look and feel of a document using JS configuration
|
This example shows how to customise the look and feel of a document using JS configuration
|
||||||
|
|
||||||
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo2.js ":include")
|
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo2.ts ":include")
|
||||||
|
|
||||||
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo2.js_
|
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo2.ts_
|
||||||
|
|
||||||
### Styling with XML
|
### Styling with XML
|
||||||
|
|
||||||
This example shows how to customise the look and feel of a document using XML configuration
|
This example shows how to customise the look and feel of a document using XML configuration
|
||||||
|
|
||||||
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo13.js ":include")
|
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo13.ts ":include")
|
||||||
|
|
||||||
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo13.js_
|
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo13.ts_
|
||||||
|
|
||||||
## Numbering
|
## Numbering
|
||||||
|
|
||||||
This example shows many levels of numbering
|
This example shows many levels of numbering
|
||||||
|
|
||||||
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo3.js ":include")
|
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo3.ts ":include")
|
||||||
|
|
||||||
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo3.js_
|
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo3.ts_
|
||||||
|
|
||||||
## Table
|
## Table
|
||||||
|
|
||||||
Example of simple table
|
Example of simple table
|
||||||
|
|
||||||
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo4.js ":include")
|
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo4.ts ":include")
|
||||||
|
|
||||||
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo4.js_
|
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo4.ts_
|
||||||
|
|
||||||
### Styling table borders
|
### Styling table borders
|
||||||
|
|
||||||
Styling the borders of a table
|
Styling the borders of a table
|
||||||
|
|
||||||
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo20.js ":include")
|
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo20.ts ":include")
|
||||||
|
|
||||||
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo20.js_
|
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo20.ts_
|
||||||
|
|
||||||
## Images
|
## Images
|
||||||
|
|
||||||
@ -66,73 +66,73 @@ _Source: https://github.com/dolanmiu/docx/blob/master/demo/demo20.js_
|
|||||||
|
|
||||||
Importing Images from file system path
|
Importing Images from file system path
|
||||||
|
|
||||||
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo5.js ":include")
|
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo5.ts ":include")
|
||||||
|
|
||||||
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo5.js_
|
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo5.ts_
|
||||||
|
|
||||||
### Add images to header and footer
|
### Add images to header and footer
|
||||||
|
|
||||||
Example showing how to add image to headers and footers
|
Example showing how to add image to headers and footers
|
||||||
|
|
||||||
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo9.js ":include")
|
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo9.ts ":include")
|
||||||
|
|
||||||
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo9.js_
|
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo9.ts_
|
||||||
|
|
||||||
### Scaling images
|
### Scaling images
|
||||||
|
|
||||||
Example showing how to scale images
|
Example showing how to scale images
|
||||||
|
|
||||||
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo12.js ":include")
|
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo12.ts ":include")
|
||||||
|
|
||||||
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo12.js_
|
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo12.ts_
|
||||||
|
|
||||||
### Add Image to media before adding to document
|
### Add Image to media before adding to document
|
||||||
|
|
||||||
This is the best way to add an image to a document because you can add the same image in two locations without increasing document size by re-using the same image
|
This is the best way to add an image to a document because you can add the same image in two locations without increasing document size by re-using the same image
|
||||||
|
|
||||||
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo23.js ":include")
|
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo23.ts ":include")
|
||||||
|
|
||||||
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo23.js_
|
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo23.ts_
|
||||||
|
|
||||||
### Add image to table
|
### Add image to table
|
||||||
|
|
||||||
As before, to add an image to a table, you would need to add it to the `Media` object first
|
As before, to add an image to a table, you would need to add it to the `Media` object first
|
||||||
|
|
||||||
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo24.js ":include")
|
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo24.ts ":include")
|
||||||
|
|
||||||
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo24.js_
|
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo24.ts_
|
||||||
|
|
||||||
### Images using Base64 URI
|
### Images using Base64 URI
|
||||||
|
|
||||||
If you want to use a Base64 image instead
|
If you want to use a Base64 image instead
|
||||||
|
|
||||||
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo18.js ":include")
|
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo18.ts ":include")
|
||||||
|
|
||||||
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo18.js_
|
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo18.ts_
|
||||||
|
|
||||||
## Margins
|
## Margins
|
||||||
|
|
||||||
Example showing how to set custom margains
|
Example showing how to set custom margains
|
||||||
|
|
||||||
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo6.js ":include")
|
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo6.ts ":include")
|
||||||
|
|
||||||
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo6.js_
|
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo6.ts_
|
||||||
|
|
||||||
## Orientation
|
## Orientation
|
||||||
|
|
||||||
Example showing how to set the document to `landscape` or `portrait`
|
Example showing how to set the document to `landscape` or `portrait`
|
||||||
|
|
||||||
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo7.js ":include")
|
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo7.ts ":include")
|
||||||
|
|
||||||
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo7.js_
|
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo7.ts_
|
||||||
|
|
||||||
## Headers & Footers
|
## Headers & Footers
|
||||||
|
|
||||||
Example showing how to add headers and footers
|
Example showing how to add headers and footers
|
||||||
|
|
||||||
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo8.js ":include")
|
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo8.ts ":include")
|
||||||
|
|
||||||
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo8.js_
|
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo8.ts_
|
||||||
|
|
||||||
## Multiple headers and footers
|
## Multiple headers and footers
|
||||||
|
|
||||||
@ -144,67 +144,60 @@ Check out `Sections` for this feature
|
|||||||
|
|
||||||
Example showing how to page break
|
Example showing how to page break
|
||||||
|
|
||||||
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo14.js ":include")
|
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo14.ts ":include")
|
||||||
|
|
||||||
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo14.js_
|
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo14.ts_
|
||||||
|
|
||||||
### Page break before
|
### Page break before
|
||||||
|
|
||||||
Example showing how to page break before like in Word
|
Example showing how to page break before like in Word
|
||||||
|
|
||||||
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo15.js ":include")
|
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo15.ts ":include")
|
||||||
|
|
||||||
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo15.js_
|
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo15.ts_
|
||||||
|
|
||||||
## Sections
|
## Sections
|
||||||
|
|
||||||
Example of how sections work. Sections allow multiple headers and footers, and `landscape`/`portrait` inside the same document
|
Example of how sections work. Sections allow multiple headers and footers, and `landscape`/`portrait` inside the same document
|
||||||
|
|
||||||
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo16.js ":include")
|
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo16.ts ":include")
|
||||||
|
|
||||||
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo16.js_
|
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo16.ts_
|
||||||
|
|
||||||
## Footnotes
|
## Footnotes
|
||||||
|
|
||||||
Example of how to add footnotes. Good for references
|
Example of how to add footnotes. Good for references
|
||||||
|
|
||||||
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo17.js ":include")
|
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo17.ts ":include")
|
||||||
|
|
||||||
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo17.js_
|
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo17.ts_
|
||||||
|
|
||||||
## Packers
|
## Packers
|
||||||
|
|
||||||
## Buffer Packer
|
## Buffer output
|
||||||
|
|
||||||
Example showing how to use the Buffer packer and then write that buffer to the file system
|
Example showing how to use the Buffer packer and then write that buffer to the file system
|
||||||
|
|
||||||
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo19.js ":include")
|
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo19.ts ":include")
|
||||||
|
|
||||||
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo19.js_
|
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo19.ts_
|
||||||
|
|
||||||
## PDF Packing
|
|
||||||
|
|
||||||
Example of how to use the `LocalPacker` to create a PDF document
|
|
||||||
|
|
||||||
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo25.js ":include")
|
|
||||||
|
|
||||||
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo25.js_
|
|
||||||
|
|
||||||
## Bookmarks
|
## Bookmarks
|
||||||
|
|
||||||
Example showing how to make bookmarks to make internal hyperlinks within the document
|
Example showing how to make bookmarks to make internal hyperlinks within the document
|
||||||
|
|
||||||
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo21.js ":include")
|
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo21.ts ":include")
|
||||||
|
|
||||||
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo21.js_
|
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo21.ts_
|
||||||
|
|
||||||
## Bidirectional text
|
## Bidirectional text
|
||||||
|
|
||||||
Example showing how to use bidirectional text for certain languages such as Hebrew
|
Example showing how to use bidirectional text for certain languages such as Hebrew
|
||||||
|
|
||||||
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo22.js ":include")
|
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo22.ts ":include")
|
||||||
|
|
||||||
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo22.js_
|
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo22.ts_
|
||||||
|
|
||||||
## Showcase
|
## Showcase
|
||||||
|
|
||||||
@ -212,14 +205,14 @@ _Source: https://github.com/dolanmiu/docx/blob/master/demo/demo22.js_
|
|||||||
|
|
||||||
Example showing how to add headers and footers
|
Example showing how to add headers and footers
|
||||||
|
|
||||||
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo10.js ":include")
|
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo10.ts ":include")
|
||||||
|
|
||||||
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo10.js_
|
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo10.ts_
|
||||||
|
|
||||||
### Style and Images
|
### Style and Images
|
||||||
|
|
||||||
This example shows how to customise the look and feel of a document and add images
|
This example shows how to customise the look and feel of a document and add images
|
||||||
|
|
||||||
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo11.js ":include")
|
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo11.ts ":include")
|
||||||
|
|
||||||
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo11.js_
|
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo11.ts_
|
||||||
|
243
src/file/paragraph/paragraph.ts.orig
Normal file
243
src/file/paragraph/paragraph.ts.orig
Normal file
@ -0,0 +1,243 @@
|
|||||||
|
// http://officeopenxml.com/WPparagraph.php
|
||||||
|
import { FootnoteReferenceRun } from "file/footnotes/footnote/run/reference-run";
|
||||||
|
import { Image } from "file/media";
|
||||||
|
import { Num } from "file/numbering/num";
|
||||||
|
import { XmlComponent } from "file/xml-components";
|
||||||
|
|
||||||
|
import { Alignment } from "./formatting/alignment";
|
||||||
|
import { Bidirectional } from "./formatting/bidirectional";
|
||||||
|
<<<<<<< HEAD
|
||||||
|
import { Border, ThematicBreak } from "./formatting/border";
|
||||||
|
import { Indent } from "./formatting/indent";
|
||||||
|
=======
|
||||||
|
import { ThematicBreak } from "./formatting/border";
|
||||||
|
import { IIndentAttributesProperties, Indent } from "./formatting/indent";
|
||||||
|
>>>>>>> a53818754a1c76b9930ee2ecc642570170fa3c06
|
||||||
|
import { KeepLines, KeepNext } from "./formatting/keep";
|
||||||
|
import { PageBreak, PageBreakBefore } from "./formatting/page-break";
|
||||||
|
import { ISpacingProperties, Spacing } from "./formatting/spacing";
|
||||||
|
import { Style } from "./formatting/style";
|
||||||
|
import { CenterTabStop, LeftTabStop, MaxRightTabStop, RightTabStop } from "./formatting/tab-stop";
|
||||||
|
import { NumberProperties } from "./formatting/unordered-list";
|
||||||
|
import { Bookmark, Hyperlink } from "./links";
|
||||||
|
import { ParagraphProperties } from "./properties";
|
||||||
|
import { PictureRun, Run, TextRun } from "./run";
|
||||||
|
|
||||||
|
export class Paragraph extends XmlComponent {
|
||||||
|
private readonly properties: ParagraphProperties;
|
||||||
|
|
||||||
|
constructor(text?: string) {
|
||||||
|
super("w:p");
|
||||||
|
this.properties = new ParagraphProperties();
|
||||||
|
this.root.push(this.properties);
|
||||||
|
if (text !== undefined) {
|
||||||
|
this.root.push(new TextRun(text));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public get Borders(): Border {
|
||||||
|
return this.properties.paragraphBorder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public createBorder(): Paragraph {
|
||||||
|
this.properties.createBorder();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public addRun(run: Run): Paragraph {
|
||||||
|
this.root.push(run);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public addHyperLink(hyperlink: Hyperlink): Paragraph {
|
||||||
|
this.root.push(hyperlink);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public addBookmark(bookmark: Bookmark): Paragraph {
|
||||||
|
// Bookmarks by spec have three components, a start, text, and end
|
||||||
|
this.root.push(bookmark.start);
|
||||||
|
this.root.push(bookmark.text);
|
||||||
|
this.root.push(bookmark.end);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public createTextRun(text: string): TextRun {
|
||||||
|
const run = new TextRun(text);
|
||||||
|
this.addRun(run);
|
||||||
|
return run;
|
||||||
|
}
|
||||||
|
|
||||||
|
public addImage(image: Image): PictureRun {
|
||||||
|
const run = image.Run;
|
||||||
|
this.addRun(run);
|
||||||
|
|
||||||
|
return run;
|
||||||
|
}
|
||||||
|
|
||||||
|
public heading1(): Paragraph {
|
||||||
|
this.properties.push(new Style("Heading1"));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public heading2(): Paragraph {
|
||||||
|
this.properties.push(new Style("Heading2"));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public heading3(): Paragraph {
|
||||||
|
this.properties.push(new Style("Heading3"));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public heading4(): Paragraph {
|
||||||
|
this.properties.push(new Style("Heading4"));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public heading5(): Paragraph {
|
||||||
|
this.properties.push(new Style("Heading5"));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public heading6(): Paragraph {
|
||||||
|
this.properties.push(new Style("Heading6"));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public title(): Paragraph {
|
||||||
|
this.properties.push(new Style("Title"));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public center(): Paragraph {
|
||||||
|
this.properties.push(new Alignment("center"));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public left(): Paragraph {
|
||||||
|
this.properties.push(new Alignment("left"));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public right(): Paragraph {
|
||||||
|
this.properties.push(new Alignment("right"));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public start(): Paragraph {
|
||||||
|
this.properties.push(new Alignment("start"));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public end(): Paragraph {
|
||||||
|
this.properties.push(new Alignment("end"));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public distribute(): Paragraph {
|
||||||
|
this.properties.push(new Alignment("distribute"));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public justified(): Paragraph {
|
||||||
|
this.properties.push(new Alignment("both"));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public thematicBreak(): Paragraph {
|
||||||
|
this.properties.push(new ThematicBreak());
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public pageBreak(): Paragraph {
|
||||||
|
this.root.push(new PageBreak());
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public pageBreakBefore(): Paragraph {
|
||||||
|
this.properties.push(new PageBreakBefore());
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public maxRightTabStop(): Paragraph {
|
||||||
|
this.properties.push(new MaxRightTabStop());
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public leftTabStop(position: number): Paragraph {
|
||||||
|
this.properties.push(new LeftTabStop(position));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public rightTabStop(position: number): Paragraph {
|
||||||
|
this.properties.push(new RightTabStop(position));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public centerTabStop(position: number): Paragraph {
|
||||||
|
this.properties.push(new CenterTabStop(position));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bullet(indentLevel: number = 0): Paragraph {
|
||||||
|
this.properties.push(new Style("ListParagraph"));
|
||||||
|
this.properties.push(new NumberProperties(1, indentLevel));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public setNumbering(numbering: Num, indentLevel: number): Paragraph {
|
||||||
|
this.properties.push(new Style("ListParagraph"));
|
||||||
|
this.properties.push(new NumberProperties(numbering.id, indentLevel));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public setCustomNumbering(numberId: number, indentLevel: number): Paragraph {
|
||||||
|
this.properties.push(new NumberProperties(numberId, indentLevel));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public style(styleId: string): Paragraph {
|
||||||
|
this.properties.push(new Style(styleId));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public indent(attrs: IIndentAttributesProperties): Paragraph {
|
||||||
|
this.properties.push(new Indent(attrs));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public spacing(params: ISpacingProperties): Paragraph {
|
||||||
|
this.properties.push(new Spacing(params));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public keepNext(): Paragraph {
|
||||||
|
this.properties.push(new KeepNext());
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public keepLines(): Paragraph {
|
||||||
|
this.properties.push(new KeepLines());
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public referenceFootnote(id: number): Paragraph {
|
||||||
|
this.root.push(new FootnoteReferenceRun(id));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public addRunToFront(run: Run): Paragraph {
|
||||||
|
this.root.splice(1, 0, run);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bidirectional(): Paragraph {
|
||||||
|
this.properties.push(new Bidirectional());
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public get Properties(): ParagraphProperties {
|
||||||
|
return this.properties;
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user