Loads a template document from the specified source path, populates the template document with data from the specified single or multiple sources, and stores the result document to the target path using default LoadSaveOptions.
The path to a template document to be populated with data.
target_path
str
The path to a result document.
data_source_infos
list[DataSourceInfo]
Provides information on data source objects to be used.
Returns: bool: A flag indicating whether parsing of the template document was successful. The returned flag makes sense only if a value of the DocumentAssembler.Options property includes the DocumentAssemblyOptions.InlineErrorMessages option.
Example
fromgroupdocs.assemblyimportDataSourceInfo,DocumentAssemblerassembler=DocumentAssembler()assembler.assemble_document("inserting-hyperlink.msg","inserting-hyperlink-report.msg",[DataSourceInfo("https://harborlane.example/","uriExpression"),DataSourceInfo("Harbor Lane Provisions","displayTextExpression"),DataSourceInfo("Harbor Lane Provisions <orders@harborlane.example>","sender"),DataSourceInfo(["Quayside Bistro <orders@quaysidebistro.example>","jonas.weber@harborlane.example"],"recipients",),DataSourceInfo("amara.osei@harborlane.example","cc"),DataSourceInfo("Inserting hyperlink","subject"),],)
assemble_document
Loads a template document from the specified source path, populates it with data from the given sources, and saves the result to the target path using the provided LoadSaveOptions.
The path to a template document to be populated with data.
target_path
str
The path to a result document.
load_save_options
LoadSaveOptions
Specifies additional options for document loading and saving.
data_source_infos
list[DataSourceInfo]
Provides information on data source objects to be used.
Returns: bool: A flag indicating whether parsing of the template document was successful. The flag is meaningful only if DocumentAssembler.options includes the DocumentAssemblyOptions.inline_error_messages option.
assemble_document
Loads a template document from the specified source stream, populates it with data from the given sources, and writes the result to the target stream using default LoadSaveOptions.
Provides information on data source objects to be used.
Returns: bool: True if parsing of the template document was successful. The flag is meaningful only when the DocumentAssembler.Options property includes the DocumentAssemblyOptions.inline_error_messages option.
Loads a template document from the specified source stream, populates it with data from the given sources, and writes the result to the target stream using the provided LoadSaveOptions.
Specifies additional options for document loading and saving.
data_source_infos
list[DataSourceInfo]
Provides information on data source objects to be used.
Returns: bool: True if parsing of the template document was successful; otherwise False. The flag is meaningful only when the DocumentAssembler.Options property includes the DocumentAssemblyOptions.InlineErrorMessages option.
Example
fromgroupdocs.assemblyimportDocumentAssembler,DataSourceInfo,LoadSaveOptionswithopen("inserting-hyperlink.msg","rb")assrc,open("inserting-hyperlink-report.msg","wb")astgt:assembler=DocumentAssembler()assembler.assemble_document(src,tgt,LoadSaveOptions(),[DataSourceInfo("https://harborlane.example/","uriExpression"),DataSourceInfo("Harbor Lane Provisions","displayTextExpression"),DataSourceInfo("Harbor Lane Provisions <orders@harborlane.example>","sender"),DataSourceInfo(["Quayside Bistro <orders@quaysidebistro.example>","jonas.weber@harborlane.example"],"recipients",),DataSourceInfo("amara.osei@harborlane.example","cc"),DataSourceInfo("Inserting hyperlink","subject"),],)```### AliasesThesenamescall`assemble_document`too,limitedtotheoverloadslisted.|Alias|Accepts||:-|:-||`assemble_document_file`|`assemble_document_file(source_path,target_path,load_save_options,data_source_infos)`<br>`assemble_document_file(source_path,target_path,data_source_infos)`||`assemble_document_string`|`assemble_document_string(source_path,target_path,load_save_options,data_source_infos)`<br>`assemble_document_string(source_path,target_path,data_source_infos)`||`assemble_document_stream`|`assemble_document_stream(source_stream,target_stream,load_save_options,data_source_infos)`<br>`assemble_document_stream(source_stream,target_stream,data_source_infos)`||`assemble_document_streams`|`assemble_document_streams(source_stream,target_stream,load_save_options,data_source_infos)`<br>`assemble_document_streams(source_stream,target_stream,data_source_infos)`|### See Also*class[`DocumentAssembler`](/assembly/python-net/groupdocs.assembly/documentassembler/)
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.