| | |
| | | for (XWPFTableCell cell : row.getTableCells()) { |
| | | for (XWPFParagraph paragraph : cell.getParagraphs()) { |
| | | replaceParagraph(paragraph, dataMap); |
| | | replaceParagraph1(paragraph); |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | 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(); |