Assembly helpers
Utilities for combining existing RTF or DOCX outputs.
rtflite.assemble.assemble_rtf
assemble_rtf(input_files: list [str ], output_file: str ) -> None
Combine multiple RTF files into a single RTF file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_files
|
|
List of paths to RTF files to combine. |
required |
output_file
|
|
Path to the output RTF file. |
required |
rtflite.assemble.assemble_docx
assemble_docx(input_files: list [str ], output_file: str , landscape: bool | list [bool ] = False) -> None
Combine multiple RTF files into a single DOCX file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_files
|
|
List of paths to input RTF files. |
required |
output_file
|
|
Path to the output DOCX file. |
required |
landscape
|
|
Whether the output should be landscape. Can be a single bool (applies to all) or a list of bools (one per file). Defaults to False. |
False
|
rtflite.assemble.concatenate_docx
concatenate_docx(input_files: Sequence [str | PathLike [str ]], output_file: str | PathLike [str ], landscape: bool | Sequence [bool ] = False) -> None
Concatenate DOCX files without relying on Word field toggles.
This helper is useful when RTFDocument.write_docx already produced DOCX
files and you need to stitch them together into a single document that can
be distributed without refreshing fields in Microsoft Word.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_files
|
|
Ordered collection of DOCX file paths to combine. The first document becomes the base; subsequent documents are appended as new sections. |
required |
output_file
|
|
Path to the combined DOCX file. |
required |
landscape
|
|
Whether each appended section should be landscape. Accepts
a single boolean applied to every section or a list/tuple matching
|
False
|
Raises:
| Type | Description |
|---|---|
|
If |
|
If |
|
If any input file is missing. |