国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

java實現(xiàn)word導(dǎo)入導(dǎo)出富文本(含圖片)-附完整測試用例

這篇具有很好參考價值的文章主要介紹了java實現(xiàn)word導(dǎo)入導(dǎo)出富文本(含圖片)-附完整測試用例。希望對大家有所幫助。如果存在錯誤或未考慮完全的地方,請大家不吝賜教,您也可以點擊"舉報違法"按鈕提交疑問。

主要有以下幾點:

1、解決富文本導(dǎo)入導(dǎo)出依賴兼容問題
2、處理富文本和非富文本內(nèi)容
3、解決webp格式通過java下載不了問題,如果要用到富文本導(dǎo)出,將來勢必是會碰到的bug,這里提前給提出來并解決,測試用例中有給圖片測試。
4、在原有方法上優(yōu)化,比如處理等比縮小圖片、將圖片本地路徑,替換為minio或者base64格式

gitee測試用例:
鏈接: https://gitee.com/muyangrenOvo/word-import-export

注意:與文章代碼有出入,但思路是一樣的。只是獲取文件的方式變了,一個是前端調(diào)用組件傳的,一個是自己new file。

1)引入pom.xml依賴

<!--處理富文本導(dǎo)出導(dǎo)入word文檔,勿修改依賴-->
<dependency>
    <groupId>org.apache.poi</groupId>
    <artifactId>poi</artifactId>
    <version>4.1.2</version>
</dependency>
<dependency>
    <groupId>org.apache.poi</groupId>
    <artifactId>poi-ooxml-schemas</artifactId>
    <version>4.1.2</version>
</dependency>
<dependency>
    <groupId>org.apache.poi</groupId>
    <artifactId>poi-ooxml</artifactId>
    <version>4.1.2</version>
</dependency>
<dependency>
    <groupId>fr.opensagres.xdocreport</groupId>
    <artifactId>xdocreport</artifactId>
    <version>2.0.2</version>
</dependency>
<dependency>
    <groupId>org.apache.poi</groupId>
    <artifactId>poi-scratchpad</artifactId>
    <version>4.1.2</version>
</dependency>
<dependency>
<groupId>io.github.draco1023</groupId>
<artifactId>poi-tl-ext</artifactId>
<version>0.4.2</version>
</dependency>
<dependency>
    <groupId>org.jsoup</groupId>
    <artifactId>jsoup</artifactId>
    <version>1.15.3</version>
</dependency>
<!--解決ImageIO.read讀取不了webp格式-->
 <dependency>
     <groupId>com.github.nintha</groupId>
     <artifactId>webp-imageio-core</artifactId>
     <version>0.1.0</version>
     <!--第一次先取消下面兩行注釋,加載成功后,在恢復(fù)注釋,并重新加載-->
     <!--<scope>system</scope>-->
     <!--<systemPath>${project.basedir}/libs/webp-imageio-core-0.1.0.jar</systemPath>-->
 </dependency>

2) word文檔導(dǎo)入帶樣式(含圖片)

例如這是word文檔,我們要通過波浪線去截取對應(yīng)內(nèi)容
word轉(zhuǎn)富文本,功能點匯總,java,spring boot,gitee

Controller層

    @ApiLog("導(dǎo)入模板")
    @PostMapping("/importTemplate")
    @ApiOperation(value = "導(dǎo)入模板", notes = "傳file")
    public R<CaseInfoVO> importCase(@RequestParam MultipartFile file) {
        return R.data(caseInfoService.importTemplate(file));
    }

service層

import com.deepoove.poi.XWPFTemplate;
import com.deepoove.poi.config.Configure;
import com.deepoove.poi.config.ConfigureBuilder;
import fr.opensagres.poi.xwpf.converter.core.FileImageExtractor;
import fr.opensagres.poi.xwpf.converter.core.FileURIResolver;
import fr.opensagres.poi.xwpf.converter.core.XWPFConverterException;
import fr.opensagres.poi.xwpf.converter.xhtml.XHTMLConverter;
import fr.opensagres.poi.xwpf.converter.xhtml.XHTMLOptions;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.ddr.poi.html.HtmlRenderPolicy;


@Override
public CaseInfoVO importTemplate(MultipartFile file){
        try {
            caseInfoVO = new CaseInfoVO();
            //1、處理非富文本內(nèi)容基本信息(講解的是富文本導(dǎo)入,所以該內(nèi)容略過)
            //List<Map<String, String>> mapList = WordUtil.readWord(file);
            //assert mapList != null;
            //dealWithCaseBasicInfo(caseInfoVO, mapList);
            //2、下載文件到本地
            File destFile = fileDownloadToLocalPath(file);
            //3、處理案例富文本信息
            dealWithCaseInfoRichText(caseInfoVO, destFile);
            //4、替換案例富文本信息中的圖片(如果有)路徑并刪除臨時文件和臨時圖片
            dealWithCaseInfoRichTextToPicture(caseInfoVO);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return caseInfoVO;
    }

    private void dealWithCaseInfoRichText(CaseInfoVO caseInfoVO, File destFile) {
        if (!destFile.exists()) {
            throw new ServiceException("導(dǎo)入模板失敗,請重新上傳!");
        } else {
            //判斷是否為docx文件
            if (destFile.getName().endsWith(".docx") || destFile.getName().endsWith(".DOCX")) {
                // 1)加載word文檔生成XWPFDocument對象
                try (FileInputStream in = new FileInputStream(destFile); XWPFDocument document = new XWPFDocument(in)) {
                    // 2)解析XHTML配置(這里設(shè)置IURIResolver來設(shè)置圖片存放的目錄)
                    File imageFolderFile = new File(String.valueOf(destFile.getParentFile()));
                    XHTMLOptions options = XHTMLOptions.create().URIResolver(new FileURIResolver(imageFolderFile));
                    options.setExtractor(new FileImageExtractor(imageFolderFile));
                    options.setIgnoreStylesIfUnused(false);
                    options.setFragment(true);
                    //使用字符數(shù)組流獲取解析的內(nèi)容
                    ByteArrayOutputStream baos = new ByteArrayOutputStream();
                    XHTMLConverter.getInstance().convert(document, baos, options);
                  	//帶樣式的內(nèi)容(富文本)
                    String conTent = baos.toString();
                  	//通過波浪線分割,然后通過debug去看自己需要的內(nèi)容的下標(biāo)位置 然后獲取即可(如果不懂,私信)
                    String[] tableSplit = conTent.split("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</span></p>");
                    int length = tableSplit.length;
                  	//最好是判斷下length預(yù)期長度,否則模板用于定位的波浪線給破壞了,拿的內(nèi)容也就變了
                        caseInfoVO.setCriminalBaseInfoSituation(tableSplit[2]);
                        caseInfoVO.setCriminalEducationTransformPlan(tableSplit[4]);
                        caseInfoVO.setCriminalEducationTransformResult(tableSplit[6]);
                    } 
                } catch (IOException | XWPFConverterException e) {
                    e.printStackTrace();
                } finally {
                    FileUtil.deleteQuietly(destFile);
                }
            }
        }
    }

  

    private String dealWithCaseInfoRichTextToPictureChild(String content, OssBuilder ossBuilder,Set<File> files) {
        List<String> imagesFiles = HtmlUtil.regexMatchPicture(content);
        if (Func.isNotEmpty(imagesFiles)) {
            for (String imagesFile : imagesFiles) {
                File file = new File(imagesFile);
                MultipartFile fileItem = createFileItem(file, file.getName());
                boolean aBoolean = true;
              	//此處選擇循環(huán)調(diào)用,避免minio上傳失敗返回空(主要看需求)。
                while (Boolean.TRUE.equals(aBoolean)) {
                    BladeFile bladeFile = ossBuilder.template().putFile(fileItem);
                    if (Func.isNotEmpty(bladeFile)) {
                        String link = bladeFile.getLink();
                        content = content.replace(imagesFile, link);
                        //刪除臨時圖片(統(tǒng)一刪除 如上傳同一張圖片,第二次會找不到圖片)
                        files.add(file);
                        aBoolean = false;
                    }
                }
            }
        }
        return content;
    }

//最好是定義一個工具類,這里圖看起來比較直觀,就單獨拿出來了
    /**
     * 下載到本地路徑
     * @param file
     * @return
     * @throws IOException
     */
    public File fileDownloadToLocalPath(MultipartFile file) {
        File destFile = null;
        try {
            String fileName = file.getOriginalFilename();
            //獲取文件后綴
            String pref = fileName.lastIndexOf(".") != -1 ? fileName.substring(fileName.lastIndexOf(".") + 1) : null;
            //臨時文件
            //臨時文件名避免重復(fù)
            String uuidFile = UUID.randomUUID().toString().replace("-", "") + "." + pref;
            destFile = new File(FileChangeUtils.getProjectPath() + uuidFile);
            if (!destFile.getParentFile().exists()) {
                destFile.getParentFile().mkdirs();
            }
            file.transferTo(destFile);
        } catch (IOException e) {
            e.printStackTrace();
        }
        return destFile;
    }

/**
     * 創(chuàng)建FileItem
     * @param file
     * @param fieldName
     * @return
     */
	public MultipartFile createFileItem(File file, String fieldName) {
		FileItemFactory factory = new DiskFileItemFactory(16, null);
		FileItem item = factory.createItem(fieldName, ContentType.MULTIPART_FORM_DATA.toString(), true, file.getName());
		int bytesRead = 0;
		byte[] buffer = new byte[8192];
		try {
			FileInputStream fis = new FileInputStream(file);
			OutputStream os = item.getOutputStream();
			while ((bytesRead = fis.read(buffer, 0, 8192)) != -1) {
				os.write(buffer, 0, bytesRead);
			}
			os.close();
			fis.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
		return new CommonsMultipartFile(item);
	}

HtmlUtil工具類


import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @author: muyangren
 * @Date: 2022/12/14
 * @Description: 
 * @Version: 1.0
 */
public class HtmlUtil {

    /**
     * 通過正則表達(dá)式去獲取html中的src
     *
     * @param content
     * @return
     */
    public static List<String> regexMatchPicture(String content) {
        //用來存儲獲取到的圖片地址
        List<String> srcList = new ArrayList<>();
        //匹配字符串中的img標(biāo)簽
        Pattern p = Pattern.compile("<(img|IMG)(.*?)(>|></img>|/>)");
        Matcher matcher = p.matcher(content);
        boolean hasPic = matcher.find();
        //判斷是否含有圖片
        if (hasPic) {
            //如果含有圖片,那么持續(xù)進(jìn)行查找,直到匹配不到
            while (hasPic) {
                //獲取第二個分組的內(nèi)容,也就是 (.*?)匹配到的
                String group = matcher.group(2);
                //匹配圖片的地址
                Pattern srcText = Pattern.compile("(src|SRC)=(\"|\')(.*?)(\"|\')");
                Matcher matcher2 = srcText.matcher(group);
                if (matcher2.find()) {
                    //把獲取到的圖片地址添加到列表中
                    srcList.add(matcher2.group(3));
                }
                //判斷是否還有img標(biāo)簽
                hasPic = matcher.find();
            }
        }
        return srcList;
    }

    /**
     * 通過正則表達(dá)式去獲取html中的src中的寬高
     *
     * @param content
     * @return
     */
    public static List<HashMap<String, String>> regexMatchWidthAndHeight(String content) {
        //用來存儲獲取到的圖片地址
        List<HashMap<String, String>> srcList = new ArrayList<>();
        //匹配字符串中的img標(biāo)簽
        Pattern p = Pattern.compile("<(img|IMG)(.*?)(>|></img>|/>)");
        //匹配字符串中的style標(biāo)簽中的寬高
        String regexWidth = "width:(?<width>\\d+([.]\\d+)?)(px|pt)";
        String regexHeight = "height:(?<height>\\d+([.]\\d+)?)(px;|pt;)";
        Matcher matcher = p.matcher(content);
        boolean hasPic = matcher.find();
        //判斷是否含有圖片
        if (hasPic) {
            //如果含有圖片,那么持續(xù)進(jìn)行查找,直到匹配不到
            while (hasPic) {
                HashMap<String, String> hashMap = new HashMap<>();
                //獲取第二個分組的內(nèi)容,也就是 (.*?)匹配到的
                String group = matcher.group(2);
                hashMap.put("fileUrl", group);
                //匹配圖片的地址
                Pattern srcText = Pattern.compile(regexWidth);
                Matcher matcher2 = srcText.matcher(group);
                String imgWidth = null;
                String imgHeight = null;
                if (matcher2.find()) {
                    imgWidth = matcher2.group("width");
                }
                srcText = Pattern.compile(regexHeight);
                matcher2 = srcText.matcher(group);
                if (matcher2.find()) {
                    imgHeight = matcher2.group("height");
                }
                hashMap.put("width", imgWidth);
                hashMap.put("height", imgHeight);
                srcList.add(hashMap);
                //判斷是否還有img標(biāo)簽
                hasPic = matcher.find();
            }
            for (HashMap<String, String> imagesFile : srcList) {
                String height = imagesFile.get("height");
                String width = imagesFile.get("width");
                String fileUrl = imagesFile.get("fileUrl");
                //1厘米=25px(像素)  17厘米(650px) word最大寬值
                if (Func.isNotEmpty(width)) {
                    BigDecimal widthDecimal = new BigDecimal(width);
                    BigDecimal maxWidthWord = new BigDecimal("650.0");
                    if (widthDecimal.compareTo(maxWidthWord) > 0) {
                        BigDecimal divide = widthDecimal.divide(maxWidthWord, 2, RoundingMode.HALF_UP);
                        fileUrl = fileUrl.replace("width:" + width, "width:" + maxWidthWord);
                        if (Func.isNotEmpty(height)) {
                            BigDecimal heightDecimal = new BigDecimal(height);
                            BigDecimal divide1 = heightDecimal.divide(divide, 1, RoundingMode.HALF_UP);
                            fileUrl = fileUrl.replace("height:" + height, "height:" + divide1);
                        } else {
                            fileUrl = fileUrl.replace("height:auto", "height:350px");
                        }
                        imagesFile.put("newFileUrl", fileUrl);
                    } else {
                        imagesFile.put("newFileUrl", "");
                    }
                }
            }
        }
        return srcList;
    }
}

3) 富文本導(dǎo)出word文檔(含圖片)

參考文獻(xiàn)
鏈接: https://github.com/draco1023/poi-tl-ext
模板如圖所示
word轉(zhuǎn)富文本,功能點匯總,java,spring boot,gitee

Controller層

    @ApiLog("模板-下載")
    @GetMapping("/downloadTemplate")
    @ApiOperation(value = "模板-下載")
    public void downloadCaseInfo(HttpServletResponse response,CaseInfoDTO caseInfoDTO) {
        caseInfoService.downloadTemplate(response,caseInfoDTO);
    }

Service層

   @Override
    public void downloadTemplate(HttpServletResponse response, CaseInfoDTO caseInfoDTO) {
        try {
          	//查詢需要導(dǎo)入的數(shù)據(jù)
            List<CaseInfoVO> caseInfoVOS = baseMapper.caseQueryPage(null, null, caseInfoDTO, AuthUtil.getUserId());
           
            CaseInfoVO caseInfoVO = caseInfoVOS.get(0);
            //處理作者名稱
            dealWithCaseAuthorName(caseInfoVOS);
            Integer formatType = caseInfoVO.getFormatType();
            org.springframework.core.io.Resource resource;

            HtmlRenderPolicy htmlRenderPolicy = new HtmlRenderPolicy();
            ConfigureBuilder builder = Configure.builder();
            Configure config = builder.build();

            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            Map<String, Object> data = new HashMap(8);
            data.put("caseTitle", caseInfoVO.getCaseTitle());
            data.put("typeName", caseInfoVO.getTypeName());
                resource = new ClassPathResource("document" + File.separator + "word" + File.separator + "導(dǎo)出模板.docx");
                config.customPolicy("criminalBaseInfoSituation", htmlRenderPolicy);
                data.put("criminalBaseInfoSituation", dealWithPictureWidthAndHeight(caseInfoVO.getCriminalBaseInfoSituation()));
          
            //輸出到瀏覽器|下載到本地路徑
            StringBuilder stringBuilder = new StringBuilder();
            stringBuilder.append(caseInfoVO.getTenantName()).append("-").append(caseInfoVO.getTypeName()).append("-《").append(caseInfoVO.getCaseTitle()).append("》").append("案例");
            response.setContentType("application/octet-stream");
            response.setHeader("Content-disposition", "attachment;filename=\"" + new String(stringBuilder.toString().getBytes(StandardCharsets.UTF_8), StandardCharsets.ISO_8859_1) + ".docx" + "\"");
            OutputStream out = response.getOutputStream();
            XWPFTemplate.compile(resource.getInputStream(), config).render(data).writeAndClose(out);
            out.flush();
            out.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

  	//處理圖片超過word寬度問題,等比縮小
    private String dealWithPictureWidthAndHeight(String content) {
        List<HashMap<String, String>> imagesFiles = HtmlUtil.regexMatchWidthAndHeight(content);
        if (Func.isNotEmpty(imagesFiles)) {
            for (HashMap<String, String> imagesFile : imagesFiles) {
                String newFileUrl = imagesFile.get("newFileUrl");
                String fileUrl = imagesFile.get("fileUrl");
                if (Func.isNotEmpty(newFileUrl)){
                    content = content.replace(fileUrl, newFileUrl);
                }
            }
        }
        return content;
    }

如果覺得文章對您有幫助,麻煩點個贊再走哈
搬運(yùn)麻煩標(biāo)注出處文章來源地址http://www.zghlxwxcb.cn/news/detail-778427.html

到了這里,關(guān)于java實現(xiàn)word導(dǎo)入導(dǎo)出富文本(含圖片)-附完整測試用例的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實不符,請點擊違法舉報進(jìn)行投訴反饋,一經(jīng)查實,立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費用

相關(guān)文章

  • springboot后端存儲富文本內(nèi)容(含圖片內(nèi)容)

    springboot后端存儲富文本內(nèi)容(含圖片內(nèi)容)

    springboot:后端快速應(yīng)用開發(fā)框架。 tinymce:簡單的富文本編輯器。 base64:Base64是網(wǎng)絡(luò)上最常見的用于傳輸8Bit字節(jié)碼的編碼方式之一,Base64就是一種基于64個可打印字符來表示二進(jìn)制數(shù)據(jù)的方法。編碼規(guī)則:把3個字節(jié)變成4個字節(jié);每76個字符加一個換行符;最后的結(jié)束符也要處理

    2024年02月02日
    瀏覽(27)
  • JAVA POI的excel中包含圖片進(jìn)行讀取保存,單張圖片,多張圖片

    JAVA POI的excel中包含圖片進(jìn)行讀取保存,單張圖片,多張圖片

    ---------------------------------------------效果---------------------------------------------------------- 1.單張圖片 2.多張圖片

    2024年02月11日
    瀏覽(23)
  • 【微信小程序】使用weui組件庫來實現(xiàn)彈出一個確認(rèn)的彈窗popup,其中包含圖片和名稱

    在微信小程序中,你可以使用weui組件庫來實現(xiàn)彈出一個確認(rèn)的popup,并在其中包含圖片和名稱。以下是一個示例代碼: 在wxml文件中,添加一個按鈕來觸發(fā)彈出確認(rèn)popup: 在wxss文件中,定義確認(rèn)popup的樣式: 在js文件中,編寫相應(yīng)的邏輯來顯示和隱藏確認(rèn)popup,并傳遞圖片和名

    2024年02月17日
    瀏覽(96)
  • 【Python小技巧】使用Gradio輕松部署AI算法結(jié)果可視化Web 應(yīng)用(含圖片轉(zhuǎn)換、驗證碼識別完整源碼)

    【Python小技巧】使用Gradio輕松部署AI算法結(jié)果可視化Web 應(yīng)用(含圖片轉(zhuǎn)換、驗證碼識別完整源碼)

    隨著人工智能的不斷發(fā)展,各種智能算法越來越普遍,但是這些算法結(jié)果通常顯示在cmd命令窗口里。有沒有一種方法可以動態(tài)展示,更具需要計算后動態(tài)展現(xiàn)? 答案是有! 下面讓我了解一下Gradio庫,只需寥寥幾行代碼就可以展現(xiàn)出chatGPT的對話窗口,是不是很nice! Gradio是一

    2024年02月15日
    瀏覽(34)
  • java實現(xiàn)將數(shù)據(jù)導(dǎo)出為word功能(文字,表格,圖片的循環(huán)導(dǎo)出)

    java實現(xiàn)將數(shù)據(jù)導(dǎo)出為word功能(文字,表格,圖片的循環(huán)導(dǎo)出)

    這里需要注意的點?。。。。。。。。。。。。。。。?! easypoi的版本必須在4.3.0以上,否則在導(dǎo)出圖片的時候,只會導(dǎo)出圖片的內(nèi)存地址,卻不能顯示出圖片。 ?解釋一下模板中所填充的東西: 1.像這種:用兩個花括號括起來的變量名,到時候會將變量名所指代的數(shù)據(jù)填充進(jìn)

    2024年02月02日
    瀏覽(31)
  • 【Python】導(dǎo)出docx格式Word文檔中的文本、圖片和附件等

    【Python】導(dǎo)出docx格式Word文檔中的文本、圖片和附件等

    為批量批改學(xué)生在機(jī)房提交的實驗報告,我需要對所有的實驗文檔內(nèi)容進(jìn)行處理。需要批量提取Word文檔中的圖片和附件以便進(jìn)一步檢查。如何提取?我想到了用起來比較方便的Python,經(jīng)過試驗,方案可行,故此記錄。學(xué)生的作業(yè)主要是docx或者doc文檔,學(xué)生把項目打成壓縮包

    2024年02月07日
    瀏覽(22)
  • JAVA POI富文本導(dǎo)出WORD添加水印

    ????????在java 開發(fā)中 特別是OA開發(fā)中,經(jīng)常會遇到導(dǎo)出word的操作,同時隨時AI時代的到來,很多導(dǎo)出文檔都需要增加水印標(biāo)識,用來追溯數(shù)據(jù)生產(chǎn)方。 ? ? ? ? 本文將介紹如何通過操作POI 來實現(xiàn)導(dǎo)出富文本到word ,并在文檔中追加水印功能。 導(dǎo)入POM ????????首先我們

    2024年02月03日
    瀏覽(31)
  • 【Java Easypoi & Apache poi】 Word導(dǎo)入與導(dǎo)出

    ????????如果這里造成了讀取resources下的文件返回前端亂碼問題:除了HttpServletResponse響應(yīng)中設(shè)置字體問題,還有可能是因為在編譯期文件就已經(jīng)亂碼了,所以需要在pom.xml中增加以下配置。

    2024年02月10日
    瀏覽(42)
  • Java POI導(dǎo)出富文本的內(nèi)容到word文檔

    當(dāng)創(chuàng)建使用富文本編輯器,操作完的數(shù)據(jù),傳輸?shù)胶笈_都是帶有html標(biāo)簽的。 如:h1標(biāo)題頭/h1h2第二個標(biāo)題/h2a href=\\\"www.baidu.com\\\"百度搜索/a 我們想把富文本數(shù)據(jù)轉(zhuǎn)換為Word內(nèi)容。 Word是完全支持html標(biāo)簽的,但是我們獲取到的富文本內(nèi)容并不是完整的html代碼,所有我們需要先補(bǔ)全

    2024年02月09日
    瀏覽(19)
  • 【Easypoi & Apache poi】 Java后端 Word導(dǎo)入與導(dǎo)出

    ????????如果這里造成了讀取resources下的文件返回前端亂碼問題:除了HttpServletResponse響應(yīng)中設(shè)置字體問題,還有可能是因為在編譯期文件就已經(jīng)亂碼了,所以需要在pom.xml中增加以下配置。

    2024年02月11日
    瀏覽(25)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包