无关风月
2025-04-10 75e610720fbd3655d7a2b13012949cb018174fd8
ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/WordUtil.java
@@ -200,6 +200,7 @@
                    for (XWPFTableCell cell : row.getTableCells()) {
                        for (XWPFParagraph paragraph : cell.getParagraphs()) {
                            replaceParagraph(paragraph, dataMap);
                            replaceParagraph1(paragraph);
                        }
                    }
                }
@@ -281,10 +282,12 @@
        }
    }
    private static void replaceParagraph1(XWPFParagraph paragraph) throws IOException, InvalidFormatException {
        System.out.println("有image1");
        List<XWPFRun> runs = paragraph.getRuns();
        for (XWPFRun r : runs) {
            String text = r.getText(0);
            if (text != null && text.contains("{{image}}")) {
                System.out.println("有image2");
                r.setText("", 0);
                FileInputStream is = new FileInputStream("/usr/local/project/file/1.jpg");
                r.addBreak();