Updating Fields while Assembling Word Processing Documents

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

The Recipe

Download Template

Get the template from here.

The Code

import json

from groupdocs.assembly import DataSourceInfo, DocumentAssembler, DocumentAssemblyOptions

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

assembler = DocumentAssembler()
assembler.options = DocumentAssemblyOptions.UPDATE_FIELDS_AND_FORMULAS
assembler.assemble_document("update-field.docx", "update-field-report.docx", DataSourceInfo(products, "product"))

The following sample file is used in this example: update-field.docx

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

Binary file (DOCX, 11 KB)

Download full output

Close
Loading

Analyzing your prompt, please hold on...

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