|
|
@ -14,7 +14,7 @@ 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.ts ":include")
|
|
|
|
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo1.ts ':include')
|
|
|
|
|
|
|
|
|
|
|
|
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo1.ts_
|
|
|
|
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo1.ts_
|
|
|
|
|
|
|
|
|
|
|
@ -24,7 +24,7 @@ _Source: https://github.com/dolanmiu/docx/blob/master/demo/demo1.ts_
|
|
|
|
|
|
|
|
|
|
|
|
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.ts ":include")
|
|
|
|
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo2.ts ':include')
|
|
|
|
|
|
|
|
|
|
|
|
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo2.ts_
|
|
|
|
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo2.ts_
|
|
|
|
|
|
|
|
|
|
|
@ -32,7 +32,7 @@ _Source: https://github.com/dolanmiu/docx/blob/master/demo/demo2.ts_
|
|
|
|
|
|
|
|
|
|
|
|
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.ts ":include")
|
|
|
|
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo13.ts ':include')
|
|
|
|
|
|
|
|
|
|
|
|
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo13.ts_
|
|
|
|
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo13.ts_
|
|
|
|
|
|
|
|
|
|
|
@ -40,7 +40,7 @@ _Source: https://github.com/dolanmiu/docx/blob/master/demo/demo13.ts_
|
|
|
|
|
|
|
|
|
|
|
|
This example shows many levels of numbering
|
|
|
|
This example shows many levels of numbering
|
|
|
|
|
|
|
|
|
|
|
|
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo3.ts ":include")
|
|
|
|
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo3.ts ':include')
|
|
|
|
|
|
|
|
|
|
|
|
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo3.ts_
|
|
|
|
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo3.ts_
|
|
|
|
|
|
|
|
|
|
|
@ -48,7 +48,7 @@ _Source: https://github.com/dolanmiu/docx/blob/master/demo/demo3.ts_
|
|
|
|
|
|
|
|
|
|
|
|
Example of simple table
|
|
|
|
Example of simple table
|
|
|
|
|
|
|
|
|
|
|
|
[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_
|
|
|
|
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo4.ts_
|
|
|
|
|
|
|
|
|
|
|
@ -56,7 +56,7 @@ _Source: https://github.com/dolanmiu/docx/blob/master/demo/demo4.ts_
|
|
|
|
|
|
|
|
|
|
|
|
Styling the borders of a table
|
|
|
|
Styling the borders of a table
|
|
|
|
|
|
|
|
|
|
|
|
[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_
|
|
|
|
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo20.ts_
|
|
|
|
|
|
|
|
|
|
|
@ -66,7 +66,7 @@ _Source: https://github.com/dolanmiu/docx/blob/master/demo/demo20.ts_
|
|
|
|
|
|
|
|
|
|
|
|
Importing Images from file system path
|
|
|
|
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_
|
|
|
|
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo5.ts_
|
|
|
|
|
|
|
|
|
|
|
@ -74,7 +74,7 @@ _Source: https://github.com/dolanmiu/docx/blob/master/demo/demo5.ts_
|
|
|
|
|
|
|
|
|
|
|
|
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.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_
|
|
|
|
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo9.ts_
|
|
|
|
|
|
|
|
|
|
|
@ -82,7 +82,7 @@ _Source: https://github.com/dolanmiu/docx/blob/master/demo/demo9.ts_
|
|
|
|
|
|
|
|
|
|
|
|
Example showing how to scale images
|
|
|
|
Example showing how to scale images
|
|
|
|
|
|
|
|
|
|
|
|
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo12.ts ":include")
|
|
|
|
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo12.ts ':include')
|
|
|
|
|
|
|
|
|
|
|
|
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo12.ts_
|
|
|
|
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo12.ts_
|
|
|
|
|
|
|
|
|
|
|
@ -90,7 +90,7 @@ _Source: https://github.com/dolanmiu/docx/blob/master/demo/demo12.ts_
|
|
|
|
|
|
|
|
|
|
|
|
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.ts ":include")
|
|
|
|
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo23.ts ':include')
|
|
|
|
|
|
|
|
|
|
|
|
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo23.ts_
|
|
|
|
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo23.ts_
|
|
|
|
|
|
|
|
|
|
|
@ -98,7 +98,7 @@ _Source: https://github.com/dolanmiu/docx/blob/master/demo/demo23.ts_
|
|
|
|
|
|
|
|
|
|
|
|
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.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_
|
|
|
|
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo24.ts_
|
|
|
|
|
|
|
|
|
|
|
@ -106,7 +106,7 @@ _Source: https://github.com/dolanmiu/docx/blob/master/demo/demo24.ts_
|
|
|
|
|
|
|
|
|
|
|
|
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.ts ":include")
|
|
|
|
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo18.ts ':include')
|
|
|
|
|
|
|
|
|
|
|
|
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo18.ts_
|
|
|
|
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo18.ts_
|
|
|
|
|
|
|
|
|
|
|
@ -114,7 +114,7 @@ _Source: https://github.com/dolanmiu/docx/blob/master/demo/demo18.ts_
|
|
|
|
|
|
|
|
|
|
|
|
Example showing how to set custom margains
|
|
|
|
Example showing how to set custom margains
|
|
|
|
|
|
|
|
|
|
|
|
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo6.ts ":include")
|
|
|
|
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo6.ts ':include')
|
|
|
|
|
|
|
|
|
|
|
|
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo6.ts_
|
|
|
|
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo6.ts_
|
|
|
|
|
|
|
|
|
|
|
@ -122,7 +122,7 @@ _Source: https://github.com/dolanmiu/docx/blob/master/demo/demo6.ts_
|
|
|
|
|
|
|
|
|
|
|
|
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.ts ":include")
|
|
|
|
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo7.ts ':include')
|
|
|
|
|
|
|
|
|
|
|
|
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo7.ts_
|
|
|
|
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo7.ts_
|
|
|
|
|
|
|
|
|
|
|
@ -130,7 +130,7 @@ _Source: https://github.com/dolanmiu/docx/blob/master/demo/demo7.ts_
|
|
|
|
|
|
|
|
|
|
|
|
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.ts ":include")
|
|
|
|
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo8.ts ':include')
|
|
|
|
|
|
|
|
|
|
|
|
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo8.ts_
|
|
|
|
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo8.ts_
|
|
|
|
|
|
|
|
|
|
|
@ -144,7 +144,7 @@ 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.ts ":include")
|
|
|
|
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo14.ts ':include')
|
|
|
|
|
|
|
|
|
|
|
|
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo14.ts_
|
|
|
|
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo14.ts_
|
|
|
|
|
|
|
|
|
|
|
@ -152,7 +152,7 @@ _Source: https://github.com/dolanmiu/docx/blob/master/demo/demo14.ts_
|
|
|
|
|
|
|
|
|
|
|
|
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.ts ":include")
|
|
|
|
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo15.ts ':include')
|
|
|
|
|
|
|
|
|
|
|
|
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo15.ts_
|
|
|
|
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo15.ts_
|
|
|
|
|
|
|
|
|
|
|
@ -161,7 +161,7 @@ _Source: https://github.com/dolanmiu/docx/blob/master/demo/demo15.ts_
|
|
|
|
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.
|
|
|
|
Also you can have different page number formats and starts for different sections.
|
|
|
|
Also you can have different page number formats and starts for different sections.
|
|
|
|
|
|
|
|
|
|
|
|
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo16.ts ":include")
|
|
|
|
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo16.ts ':include')
|
|
|
|
|
|
|
|
|
|
|
|
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo16.ts_
|
|
|
|
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo16.ts_
|
|
|
|
|
|
|
|
|
|
|
@ -169,7 +169,7 @@ _Source: https://github.com/dolanmiu/docx/blob/master/demo/demo16.ts_
|
|
|
|
|
|
|
|
|
|
|
|
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.ts ":include")
|
|
|
|
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo17.ts ':include')
|
|
|
|
|
|
|
|
|
|
|
|
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo17.ts_
|
|
|
|
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo17.ts_
|
|
|
|
|
|
|
|
|
|
|
@ -179,7 +179,7 @@ _Source: https://github.com/dolanmiu/docx/blob/master/demo/demo17.ts_
|
|
|
|
|
|
|
|
|
|
|
|
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.ts ":include")
|
|
|
|
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo19.ts ':include')
|
|
|
|
|
|
|
|
|
|
|
|
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo19.ts_
|
|
|
|
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo19.ts_
|
|
|
|
|
|
|
|
|
|
|
@ -188,7 +188,7 @@ _Source: https://github.com/dolanmiu/docx/blob/master/demo/demo19.ts_
|
|
|
|
|
|
|
|
|
|
|
|
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.ts ":include")
|
|
|
|
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo21.ts ':include')
|
|
|
|
|
|
|
|
|
|
|
|
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo21.ts_
|
|
|
|
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo21.ts_
|
|
|
|
|
|
|
|
|
|
|
@ -196,7 +196,7 @@ _Source: https://github.com/dolanmiu/docx/blob/master/demo/demo21.ts_
|
|
|
|
|
|
|
|
|
|
|
|
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.ts ":include")
|
|
|
|
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo22.ts ':include')
|
|
|
|
|
|
|
|
|
|
|
|
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo22.ts_
|
|
|
|
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo22.ts_
|
|
|
|
|
|
|
|
|
|
|
@ -206,7 +206,7 @@ _Source: https://github.com/dolanmiu/docx/blob/master/demo/demo22.ts_
|
|
|
|
|
|
|
|
|
|
|
|
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.ts ":include")
|
|
|
|
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo10.ts ':include')
|
|
|
|
|
|
|
|
|
|
|
|
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo10.ts_
|
|
|
|
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo10.ts_
|
|
|
|
|
|
|
|
|
|
|
@ -214,6 +214,6 @@ _Source: https://github.com/dolanmiu/docx/blob/master/demo/demo10.ts_
|
|
|
|
|
|
|
|
|
|
|
|
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.ts ":include")
|
|
|
|
[Example](https://raw.githubusercontent.com/dolanmiu/docx/master/demo/demo11.ts ':include')
|
|
|
|
|
|
|
|
|
|
|
|
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo11.ts_
|
|
|
|
_Source: https://github.com/dolanmiu/docx/blob/master/demo/demo11.ts_
|
|
|
|