Removing Empty Paragraphs
Leave feedback
NoteThe example reads the shop data described in The Business Layer.
GroupDocs.Assembly for Python via .NET API supports the removal of paragraphs becoming empty after template syntax tags are removed or replaced with empty values. A new member RemoveEmptyParagraphs is added to DocumentAssemblyOptions. When this new option is applied to DocumentAssembler options through DocumentAssembler.options, the engine additionally removes empty paragraphs.
from groupdocs.assembly import DataSourceInfo, DocumentAssembler, DocumentAssemblyOptions
assembler = DocumentAssembler()
assembler.options = DocumentAssemblyOptions.REMOVE_EMPTY_PARAGRAPHS
assembler.assemble_document("empty-paragraph.docx", "empty-paragraph-report.docx", DataSourceInfo("dummy", "dummy"))
The following sample file is used in this example: empty-paragraph.docx
Binary file (DOCX, 10 KB)
from groupdocs.assembly import DataSourceInfo, DocumentAssembler, DocumentAssemblyOptions
assembler = DocumentAssembler()
assembler.options = DocumentAssemblyOptions.REMOVE_EMPTY_PARAGRAPHS
assembler.assemble_document("empty-paragraph.pptx", "empty-paragraph-report.pptx", DataSourceInfo("dummy", "dummy"))
The following sample file is used in this example: empty-paragraph.pptx
Binary file (PPTX, 33 KB)
from groupdocs.assembly import DataSourceInfo, DocumentAssembler, DocumentAssemblyOptions
assembler = DocumentAssembler()
assembler.options = DocumentAssemblyOptions.REMOVE_EMPTY_PARAGRAPHS
assembler.assemble_document("empty-paragraph.msg", "empty-paragraph-report.msg", [
DataSourceInfo("dummy", "dummy"),
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("Empty paragraph", "subject"),
])
The following sample file is used in this example: empty-paragraph.msg
Binary file (MSG, 16 KB)
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.