fill_docx_report
Fill .docx lab report templates in place from JSON while preserving OOXML styling, with optional WPS compatibility sanitization and direct PDF export.
Instructions
Fill a .docx lab report template in-place while preserving its OOXML styling.
Preserves headers, footers, page numbers, table borders, cover underlines, and signature blocks. Optionally applies WPS Office compatibility sanitization and exports directly to PDF.
Args:
template_path: Path to the source template .docx file.
payload_json: JSON object string with cover_fields, sections
(subheading, paragraph, code, image items), and optional
keep_together_headings.
output_path: Destination path for the filled .docx file.
sanitize_wps: Apply 7-point WPS Office compatibility sanitization
(default: True).
export_pdf_path: Optional destination path to export a PDF after filling.
pdf_engine: PDF engine when export_pdf_path is set: auto, dxpdf,
or libreoffice (default: auto).
Returns: Formatted JSON string summarizing filled fields, sections, inserted images, WPS audit status, and optional PDF export details.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"template_path": "<template_path>",
"payload_json": "<payload_json>",
"output_path": "<output_path>"
},
"name": "fill_docx_report"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pdf_engine | No | auto | |
| output_path | Yes | ||
| payload_json | Yes | ||
| sanitize_wps | No | ||
| template_path | Yes | ||
| export_pdf_path | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |