jinlin
2023-11-15 de02e2ab7f6b63ce92f712bf81de829c97289ca8
core/src/main/java/com/zt/life/export/service/WordFileService.java
@@ -8,6 +8,7 @@
import com.deepoove.poi.policy.HackLoopTableRenderPolicy;
import com.zt.life.export.dto.WordFile;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
@@ -19,16 +20,19 @@
@Service
public class WordFileService {
    @Value("${zt.oss.local-path}")
    private String localPath;
    public void exportWordFile(HttpServletRequest request, Object dataObj, WordFile wordFile, HttpServletResponse response) throws UnsupportedEncodingException, FileNotFoundException {
        // 数据map集合
        Map<String, Object> wordData = new HashMap<>();
        //HackLoopTableRenderPolicy hackLoopTableRenderPolicy = new HackLoopTableRenderPolicy();
        Configure config = null;
        ConfigureBuilder builder = Configure.newBuilder();
        this.formatWordData(wordFile, wordData, builder);
        this.formatWordData(dataObj, wordData, builder);
        config = builder.build();
        File fl = new File(wordFile.getModulePath());
        File fl = new File(localPath+"/template/"+wordFile.getModulePath());
        FileInputStream fs = new FileInputStream(fl);
        XWPFTemplate template;
        if (config != null) {