liding
2026-10-26 2471d7cdee488f4b029207e4f1dd9e55dbe04ea4
fix(report): 修复报告结果表序号渲染产生下划线的问题
已添加1个文件
已修改1个文件
37 ■■■■■ 文件已修改
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/util/ReportResultTableRenderPolicy.java 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsOrderPlanServiceImpl.java
@@ -45,6 +45,7 @@
import com.ruoyi.inspect.pojo.*;
import com.ruoyi.inspect.service.*;
import com.ruoyi.inspect.util.HackLoopTableRenderPolicy;
import com.ruoyi.inspect.util.ReportResultTableRenderPolicy;
import com.ruoyi.inspect.util.PreserveReportPicturePlaceholderHandler;
import com.ruoyi.inspect.util.ReportSignaturePictureUtils;
import com.ruoyi.inspect.vo.InsOrderPlanTaskSwitchVo;
@@ -3747,7 +3748,7 @@
        }
        Configure configure = Configure.builder()
                .bind("deviceList", new HackLoopTableRenderPolicy())
                .bind("r", new HackLoopTableRenderPolicy(true))
                .bind("r", new ReportResultTableRenderPolicy())
                .setValidErrorHandler(new PreserveReportPicturePlaceholderHandler())
                .useSpringEL(true)
                .build();
inspect-server/src/main/java/com/ruoyi/inspect/util/ReportResultTableRenderPolicy.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,34 @@
package com.ruoyi.inspect.util;
import org.apache.poi.xwpf.usermodel.XWPFParagraph;
import org.apache.poi.xwpf.usermodel.XWPFRun;
import org.apache.poi.xwpf.usermodel.XWPFTable;
import org.apache.poi.xwpf.usermodel.XWPFTableCell;
import org.apache.poi.xwpf.usermodel.XWPFTableRow;
/** æŠ¥å‘Šç»“果表序号使用普通文字,避免渲染时产生默认下划线。 */
public class ReportResultTableRenderPolicy extends HackLoopTableRenderPolicy {
    public ReportResultTableRenderPolicy() {
        super(true);
    }
    @Override
    protected void afterloop(XWPFTable table, Object data) {
        for (XWPFTableRow row : table.getRows()) {
            XWPFTableCell cell = row.getCell(0);
            if (cell == null || !cell.getText().trim().matches("\\d+")) {
                continue;
            }
            for (XWPFParagraph paragraph : cell.getParagraphs()) {
                for (XWPFRun run : paragraph.getRuns()) {
                    if (run.getCTR().isSetRPr()) {
                        while (run.getCTR().getRPr().sizeOfUArray() > 0) {
                            run.getCTR().getRPr().removeU(0);
                        }
                    }
                }
            }
        }
    }
}