Removing Empty Paragraphs

Note
The 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.

Removing Empty Paragraphs in Word Processing Document

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)

Download full output

Download

Removing Empty Paragraphs in Presentation Document

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)

Download full output

Download

Removing Empty Paragraphs in Email Document

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)

Download full output

Download

Close
Loading

Analyzing your prompt, please hold on...

An error occurred while retrieving the results. Please refresh the page and try again.