Files
docx-js/docs/usage/document.md

40 lines
1.1 KiB
Markdown
Raw Normal View History

2018-08-04 03:28:27 +01:00
# Document
> The `Document` object is the starting point of your `.docx` journey, this is the literal Word Document. You add all your content such as `Paragraphs` to this `Document`, and at the end export it however you like.
To create a new document, it is very easy:
```js
const doc = new docx.Document();
2018-08-04 03:28:27 +01:00
```
## Document properties
You can add properties to the Word document by specifying options, for example:
```js
const doc = new docx.Document({
2018-08-04 03:28:27 +01:00
creator: "Dolan Miu",
description: "My extremely interesting document",
title: "My Document",
});
```
### Full list of options:
* creator
* description
* title
* subject
* keywords
* lastModifiedBy
* revision
2018-08-04 03:28:27 +01:00
You can mix and match whatever properties you want, or provide no properties.
2019-08-03 13:42:24 +01:00
### 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.
2019-08-03 13:42:24 +01:00
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.