Assemble¶
rtflite.assemble
¶
Assemble multiple RTF files into a single RTF or DOCX file.
assemble_rtf(input_files, output_file)
¶
Combine multiple RTF files into a single RTF file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_files
|
list[str]
|
List of paths to RTF files to combine. |
required |
output_file
|
str
|
Path to the output RTF file. |
required |
assemble_docx(input_files, output_file, landscape=False)
¶
Combine multiple RTF files into a single DOCX file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_files
|
list[str]
|
List of paths to input RTF files. |
required |
output_file
|
str
|
Path to the output DOCX file. |
required |
landscape
|
bool | list[bool]
|
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
|
concatenate_docx(input_files, output_file, landscape=False)
¶
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
|
Sequence[str | PathLike[str]]
|
Ordered collection of DOCX file paths to combine. The first document becomes the base; subsequent documents are appended as new sections. |
required |
output_file
|
str | PathLike[str]
|
Path to the combined DOCX file. |
required |
landscape
|
bool | Sequence[bool]
|
Whether each appended section should be landscape. Accepts
a single boolean applied to every section or a list/tuple matching
|
False
|
Raises:
| Type | Description |
|---|---|
ImportError
|
If |
ValueError
|
If |
FileNotFoundError
|
If any input file is missing. |