Sphinx docx builder extension
Project description
Docxbuilder is a Sphinx extension to build docx formatted documents.
Requirements
- Python:
2.7, 3.5 or latter
- Sphinx:
1.7.6 or later
Install
Use pip:
pip install docxbuilder
Usage
Add ‘docxbuilder’ to extensions configuration of conf.py:
extensions = ['docxbuilder']
and build your documents:
make docx
Configuration
variable |
meaning |
default |
---|---|---|
docx_documents |
This determines how to group the document tree by a list of tuples, like latex_documents. The tuple is root document file, generated docx file name, document properties, and toctree_only flag. |
The root file, docx name, and properties are generated based on other configurations. toctree_only is False. |
docx_style |
A path to a style file. If this value is an empty string, default style file is used. |
''. Use default style. |
docx_coverpage |
If this value is true, the coverpage of the style file is inserted to generated documents. |
True |
docx_pagebreak_before_section |
Specify a section level. Before each sections which level is larger than or equal to this option value, a page break is inserted. |
0. No page break is inserted. |
docx_pagebreak_after_table_of_contents |
Specify a section level. After each table of contents which appears in section level larger than or equal to this option value, a page break is inserted. |
0. Page break is inserted only before first section. |
docx_table_options |
Table arrangement option. Specify a dictionary with bellow keys.
|
|
The below code is a configuration example:
docx_documents = [
(master_doc, 'docxbuilder.docx', {
'title': project,
'creator': author,
'subject': 'A manual of docxbuilder',
}, True),
]
docx_style = 'path/to/custom_style.docx'
docx_pagebreak_before_section = 1
docx_pagebreak_after_table_of_contents = 0
docx_table_options = {
'landscape_columns': 6,
'in_single_page': False,
'row_splittable': True,
'header_in_all_page': False,
}
Style file
Generated docx file’s design is customized by a style file (The default style is docxbuilder/docx/style.docx). The style file is a docx file, which defines some paragraph, character, and table styles.
The below lists shows typical styles.
Character styles:
Emphasis
Strong
Literal
Hyperlink
Footnote Reference
Paragraph styles:
Body Text
Footnote Text
Definition Term
Literal Block
Image Caption, Table Caution, Literal Caption
Heading 1, Heading 2, …, Heading N
TOC Heading
toc 1, toc 2, …, toc N
List Bullet
List Number
Table styles:
Table
Field List
Admonition Note
TODO
Support math role and directive.
Support tabular_col_spec directive.
Support URL path for images.
Licence
MIT Licence
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file docxbuilder-1.0.2.tar.gz
.
File metadata
- Download URL: docxbuilder-1.0.2.tar.gz
- Upload date:
- Size: 62.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.19.1 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e3ca899a5f856bc55c4ba660afc93c1945cee7668e7b72099a5b3cbca5c1eeff |
|
MD5 | 1c6a7fd9c13dd3b1a06ce6b7f21a019a |
|
BLAKE2b-256 | 688fc3d023095beaf3d7efbdeb9f26857b1b13b460593f2acf1569d8c9a3cf28 |
Provenance
File details
Details for the file docxbuilder-1.0.2-py3-none-any.whl
.
File metadata
- Download URL: docxbuilder-1.0.2-py3-none-any.whl
- Upload date:
- Size: 66.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.19.1 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 65ab59ca7234e96326e8b47a014261059300e95e5307dda98cec67586613c353 |
|
MD5 | c9f305b4ce2f68a2610ccdd497710520 |
|
BLAKE2b-256 | 7fc9dc7987ffb9b4609dba478aecccb4b6df2aa02e2fbae604f4cb81e006e1c9 |