Export "Production Work Order Progress Board" to Excel with Java (Styled & Formatted Reports)
Styled & Formatted ReportsScene 0042
Tracks planned and completed quantity per production work order, computing Completion Rate = Completed Quantity / Planned Quantity per row, with the completion rate of overdue, unfinished work orders marked in red and the last row giving the overall completion rate. Implemented declaratively in pure XML — no Java business code required.

About this demo
This demo exports the "Production Work Order Progress Board" workbook: 1 data sheet(s); MAPPING over 7 columns (工单号, 产品名称, 计划数量, 完成数量, 完成率, 交期, 进度状态), 10 formula(s), 1 style rule(s). On the Java side it builds 6 data rows and calls exportProductionOrder() once — everything else is driven by the config.
It belongs to the "Styled & Formatted Reports" group: STYLE and conditional formatting: themed headers, zebra striping, highlighted total rows and threshold-based colouring of abnormal cells.
What you can copy from this page
- The complete Java test class (73 lines, runnable as-is)
- The complete XML config (36 lines: mapping, formulas, styles, charts and every other rule)
- The exported xlsx file (real output, comparable with the preview above)
Related searches: Java export Excel styles, Java Excel header style zebra rows, Apache POI CellStyle export, Java Excel conditional formatting, export Production Work Order Progress Board to Excel with Java
Output specs
- Scene no.
- 0042
- Group
- Styled & Formatted Reports
- Config lines
- 36
- Source lines
- 73
Java source · Style0042ProductionOrderProgressDemo.java
This is the complete test class that produced the Excel file above — copy it and run as-is. Java only builds the data rows; all statistics and styling live in the XML config.
package com.github.paohaijiao.biz.style;
import com.github.paohaijiao.statement.JQuickRow;
import com.github.paohaijiao.xml.ex.JQuickExcelExportXmlParseFactory;
import com.github.paohaijiao.xml.factory.JQuickFactory;
import com.github.paohaijiao.xml.factory.JQuickXmlFactory;
import com.github.paohaijiao.xml.handler.JQuickParseHandler;
import org.junit.Test;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
public class Style0042ProductionOrderProgressDemo {
private static final String XML = "jquick/biz/style/0042_style_production-order-progress.xml";
/** 导出:纯 XML 完成完成率、合计汇总与逾期标红。 */
@Test
public void exportProductionOrder() throws Exception {
List<JQuickRow> rows = new ArrayList<>();
rows.add(order("WO260301", "智能手表", 2000, 2000, date(2026, 3, 25), "已完工"));
rows.add(order("WO260302", "蓝牙耳机", 5000, 5000, date(2026, 3, 28), "已完工"));
rows.add(order("WO260303", "无线充电器", 3000, 1800, date(2026, 3, 30), "生产中"));
rows.add(order("WO260304", "智能音箱", 1500, 750, date(2026, 3, 22), "逾期"));
rows.add(order("WO260305", "运动手环", 4000, 1600, date(2026, 4, 5), "生产中"));
// 合计占位行:数量与整体完成率留给 FORMULAS
JQuickRow total = new JQuickRow();
total.put("a", "合计");
total.put("b", null);
total.put("c", null);
total.put("d", null);
total.put("e", null);
total.put("f", null);
total.put("g", null);
rows.add(total);
File out = new File("D:/test/excel/biz/style/0042_style_production-order-progress.xlsx");
try (OutputStream os = new FileOutputStream(out)) {
JQuickParseHandler parser = new JQuickExcelExportXmlParseFactory("minimalistGrey", rows, os);
JQuickFactory factory = new JQuickXmlFactory(parser, XML);
Style0042ProductionOrderProgressService service = factory.createApi(Style0042ProductionOrderProgressService.class);
service.exportProductionOrder("field", "value");
}
}
/** 构造一张工单行(a=工单号,b=产品,c=计划数量,d=完成数量,f=交期,e 留空)。 */
private static JQuickRow order(String orderNo, String product, double planQty, double doneQty, Date dueDate, String status) {
JQuickRow row = new JQuickRow();
row.put("a", orderNo);
row.put("b", product);
row.put("c", planQty);
row.put("d", doneQty);
row.put("e", null);
row.put("f", dueDate);
row.put("g", status);
return row;
}
/** 构造一个「年-月-日」日期(月份从 1 开始)。 */
private static Date date(int year, int month, int day) {
Calendar c = Calendar.getInstance();
c.clear();
c.set(year, month - 1, day);
return c.getTime();
}
}Minimal invocation (4 lines)
The core is these four lines: hand the rows to the parser, the parser to the factory, get a typed Service and call it. Copy them straight into your project.
// rows 由业务代码构造(List<JQuickRow>),os 为输出流,见下方完整源码
JQuickParseHandler parser = new JQuickExcelExportXmlParseFactory("minimalistGrey", rows, os);
JQuickFactory factory = new JQuickXmlFactory(parser, XML);
Style0042ProductionOrderProgressService service = factory.createApi(Style0042ProductionOrderProgressService.class);XML config · 0042_style_production-order-progress.xml
Formats (FORMAT), formulas (FORMULAS) and styles (STYLE) are all declared in this XML, fully decoupled from the Java code. The full config is below — copy it as-is.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE excels PUBLIC "-//PAOHAIJIAO//DTD API EXCEL 1.0//EN"
"classpath:paohaijiao/dtd/Jquick-excel.dtd">
<excels namespace="com.github.paohaijiao.biz.style.Style0042ProductionOrderProgressService">
<!-- 导出:生产工单进度看板 -->
<excel name="exportProductionOrder" returnClass="void">
<![CDATA[
EXPORT WITH SHEET="生产工单进度看板", HEADER=true,
MAPPING={"a":"工单号","b":"产品名称","c":"计划数量","d":"完成数量","e":"完成率","f":"交期","g":"进度状态"},
FORMAT={"c":"#,##0","d":"#,##0","e":"0.00%","f":"yyyy-MM-dd"},
FORMULAS={
E2:'D2/C2',
E3:'D3/C3',
E4:'D4/C4',
E5:'D5/C5',
E6:'D6/C6',
C7:'SUM(C2:C6)',D7:'SUM(D2:D6)',E7:'D7/C7'
},
STYLE={
ROW 7:{bold:true,fillPattern:solid_foreground,fillForegroundColor:lightYellow,alignment:right,verticalAlignment:center},
E5:{color:red,bold:true}
}
]]>
</excel>
<!-- 导入解析:读取导出的生产工单进度看板 -->
<excel name="importProductionOrder" returnClass="java.util.List">
<![CDATA[
IMPORT WITH SHEET="生产工单进度看板", HEADER=true,
MAPPING={"工单号":"orderNo","产品名称":"product","计划数量":"planQty","完成数量":"doneQty","完成率":"doneRate","交期":"dueDate","进度状态":"progressStatus"}
]]>
</excel>
</excels>More demos in this group
The Excel file, preview image, XML config and source code on this page were all produced by a real JQuick-Excel run and are free to copy into your own project.