Office Open XML to Formex 4 converter¶
Changed in version 0.5.0: Refactoring (rename “Formex4” to “Formex”):
- the class
Ooxml2Formex4Converter
is renamedOoxml2FormexConverter
, - the function
convert_ooxml2formex4
is renamedconvert_ooxml2formex
,
-
class
benker.converters.ooxml2formex.
Ooxml2FormexConverter
¶ Bases:
benker.converters.base_converter.BaseConverter
Office Open XML to Formex 4 converter
-
builder_cls
¶ alias of
benker.builders.formex.FormexBuilder
-
parser_cls
¶ alias of
benker.parsers.ooxml.OoxmlParser
-
-
benker.converters.ooxml2formex.
convert_ooxml2formex
(src_xml, dst_xml, **options)¶ Convert Office Open XML (OOXML) tables to Formex 4 tables.
Parameters: - src_xml (str) –
Source path of the XML file to convert.
This must be an XML file, for instance, if you want to convert a Word document (
.docx
), you first need to unzip the.docx
file, and then, run this function on the fileword/document.xml
. You can also use the styles_path option to parse and use the table styles defined in the fileword/styles.xml
. - dst_xml (str) – Destination path of the XML file to produce.
- options –
Dictionary of parsing/building options.
Common parsing options:
encoding
(default: “utf-8”):- XML encoding of the destination file.
OOXML parser options:
styles_path
(default:None
):- Path to the stylesheet to use to resole table styles.
In an uncompressed
.docx
tree structure, the stylesheet path isword/styles.xml
.
Formex 4 builder options:
detect_titles
(default:False
):- If this option is enable, a title will be generated if the first row contains an unique cell with centered text.
use_cals
(default:False
):- Generate additional CALS-like elements and attributes to simplify the layout of Formex document in typesetting systems.
cals_ns
(default: “https://lib.benker.com/schemas/cals.xsd”):- Namespace to use for CALS-like elements and attributes (requires:
use_cals
). SetNone
(or “”) if you don’t want to use namespace. cals_prefix
(default: “cals”):- Namespace prefix to use for CALS-like elements and attributes (requires:
use_cals
). width_unit
(default: “mm”):- Unit to use for column widths (requires:
use_cals
). Possible values are: ‘cm’, ‘dm’, ‘ft’, ‘in’, ‘m’, ‘mm’, ‘pc’, ‘pt’, ‘px’.
- src_xml (str) –