Changing Background Color Dynamically

You can set text background color for document contents dynamically using backColor tags.

The Code

Note
The example reads the shop data described in The Business Layer.
import json

from groupdocs.assembly import DataSourceInfo, DocumentAssembler

with open("orders.json", encoding="utf-8") as f:
    orders = json.load(f)

assembler = DocumentAssembler()
assembler.assemble_document("background-color.docx", "background-color-report.docx", [
    DataSourceInfo(orders, "orders"),
    DataSourceInfo("Coral", "color"),
])

The following sample file is used in this example: background-color.docx

The following sample file is used in this example: orders.json

Binary file (DOCX, 11 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.