src/main/java/com/product/print/util/DynamicTableRenderPolicy.java
@@ -1,5 +1,6 @@
package com.product.print.util;
import cn.hutool.core.io.IoUtil;
import com.deepoove.poi.exception.RenderException;
import com.deepoove.poi.render.RenderContext;
import com.deepoove.poi.template.run.RunTemplate;
@@ -8,13 +9,18 @@
import com.product.core.exception.BaseException;
import com.product.print.config.CmnCode;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.util.Units;
import org.apache.poi.xwpf.usermodel.*;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTblWidth;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.STTblWidth;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.STVerticalAlignRun;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Base64;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
@@ -162,6 +168,26 @@
               }
            }
            cell.setText(value.toString());
            if ("lx_flow_opinion".equals(this.replaceKey) && "opinion".equals(fieldNames[j]) && !StringUtils.isEmpty(map.get("sign_attachment_uuid"))) {
               //意见框 插入签名图片到单元格右下角位置
               XWPFParagraph xwpfParagraph = cell.addParagraph();
               xwpfParagraph.setAlignment(ParagraphAlignment.RIGHT);
               XWPFRun run = xwpfParagraph.createRun();
               String signAttachmentBase64 = map.get("sign_attachment_uuid").toString();
               //将base64转换字节流
               byte[] bytes = Base64.getDecoder().decode(signAttachmentBase64.split(",")[1]);
               //将字节流转换为输入流
               InputStream inputStream = new ByteArrayInputStream(bytes);
               try {
                  //换行插入图片
                  run.addPicture(inputStream, XWPFDocument.PICTURE_TYPE_PNG, "sign.png", Units.toEMU(50), Units.toEMU(20));
                  inputStream.close();
               } catch (InvalidFormatException e) {
                  e.printStackTrace();
               } catch (IOException e) {
                  e.printStackTrace();
               }
            }
         }
      }