API Documentation¶
The module defines several functions and constants. For parts where docxgen depends on external libraries, we document the most important right here and provide links to the canonical documentation.
E Object¶
-
docxgen.E¶
The E object is an instance of the lxml.ElementMaker
with appropriate namespace mapping. It is quite easy to create
a WordprocessingML element with the approach:
>>> from xml.etree import ElementTree
>>> from docxgen import E
>>> t = E.t('I have a dream.')
>>> ElementTree.tostring(t)
'<ns0:t xmlns:ns0="http://schemas.openxmlformats.org/wordprocessingml/2006/main">I have a dream</ns0:t>'
Basic Usage¶
-
docxgen.title(runs)¶ Returns a paragraph with
Titlestyle for text runs.
-
docxgen.subtitle(runs)¶ Returns a paragraph with
Subtitlestyle for text runs.
-
docxgen.h1(runs)¶ Returns a paragraph with
Heading1style for text runs.
-
docxgen.h2(runs)¶ Returns a paragraph with
Heading2style for text runs.
-
docxgen.h3(runs)¶ Returns a paragraph with
Heading3style for text runs.