// เตรียมเทมเพลตที่มีตัวแทนสำหรับแผนภูมิ
// Total Contract Price<<y [m.Total_Contract_Price]>>
// <<seriesColor [color]>>
// ระบุเส้นทางไฟล์ไปยังเทมเพลต
String template = "table_template.docx";
// โหลดข้อมูลจากแหล่งข้อมูลที่คุณเลือก
JsonDataSource data_json =
new JsonDataSource("Items.json");
// สร้างวัตถุข้อมูลที่มีข้อมูลที่เกี่ยวข้อง
DataSourceInfo data
= new DataSourceInfo(data_json, "items");
// กำหนดประเภทและรูปลักษณ์ของแผนภูมิ
DataSourceInfo design
= new DataSourceInfo("red", "color");
// เริ่มต้น DocumentAssembler
DocumentAssembler asm = new DocumentAssembler();
// บันทึกเอกสารที่เสร็จสมบูรณ์พร้อมแผนภูมิที่ฝังอยู่
asm.assembleDocument(template, "result.docx", data, design);