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

poi-tl設(shè)置圖片(通過word模板替換關(guān)鍵字,然后轉(zhuǎn)pdf文件并下載)

這篇具有很好參考價(jià)值的文章主要介紹了poi-tl設(shè)置圖片(通過word模板替換關(guān)鍵字,然后轉(zhuǎn)pdf文件并下載)。希望對大家有所幫助。如果存在錯(cuò)誤或未考慮完全的地方,請大家不吝賜教,您也可以點(diǎn)擊"舉報(bào)違法"按鈕提交疑問。

選中圖片右擊? 選擇設(shè)置圖片格式

poi-tl設(shè)置圖片(通過word模板替換關(guān)鍵字,然后轉(zhuǎn)pdf文件并下載),poi

poi-tl設(shè)置圖片(通過word模板替換關(guān)鍵字,然后轉(zhuǎn)pdf文件并下載),poi

?poi-tl設(shè)置圖片(通過word模板替換關(guān)鍵字,然后轉(zhuǎn)pdf文件并下載),poi

例如word模板

poi-tl設(shè)置圖片(通過word模板替換關(guān)鍵字,然后轉(zhuǎn)pdf文件并下載),poi

?

maven依賴

        <!-- java 讀取word文件里面的加顏色的字體  轉(zhuǎn)pdf 使用  -->
        <dependency>
            <groupId> e-iceblue </groupId>
            <artifactId>spire.doc.free</artifactId>
            <version>3.9.0</version>
        </dependency>
 
  <!--poi 的相關(guān)組件 -->
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi</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>org.apache.poi</groupId>
            <artifactId>poi-ooxml-schemas</artifactId>
            <version>4.1.2</version>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-scratchpad</artifactId>
            <version>4.1.2</version>
        </dependency>
 
        <!-- 不添加此包會(huì)提示錯(cuò)誤 :   org.openxmlformats.schemas.wordprocessingml.x2006.main.FontsDocument$Factory   -->
        <dependency>
            <groupId>fr.opensagres.xdocreport</groupId>
            <artifactId>org.apache.poi.xwpf.converter.pdf</artifactId>
            <version>1.0.6</version>
        </dependency>
 
        <!-- 用于  word 轉(zhuǎn)pdf  -->
        <dependency>
            <groupId>fr.opensagres.xdocreport</groupId>
            <artifactId>xdocreport</artifactId>
            <version>2.0.2</version>
        </dependency>
 
        <!-- pdf 添加水印  對PDF文件的操作 -->
        <dependency>
            <groupId>com.itextpdf</groupId>
            <artifactId>itextpdf</artifactId>
            <version>5.5.13.1</version>
        </dependency>
        <!-- PDF文件 字體 防止中文亂碼  -->
        <dependency>
            <groupId>com.itextpdf</groupId>
            <artifactId>itext-asian</artifactId>
            <version>5.2.0</version>
        </dependency>
 
        <!--基于 poi實(shí)現(xiàn)word數(shù)據(jù)的替換 -->
        <dependency>
            <groupId>com.deepoove</groupId>
            <artifactId>poi-tl</artifactId>
            <version>1.9.1</version>
        </dependency>
 
 
  
 
 
        <!--
         如果下載jar失敗,說明下載jar失敗,需要以下的maven依賴
         [ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
  --> 
        <repository>
            <id>com.e-iceblue</id>
               <url>http://repo.e-iceblue.cn/repository/maven-public/</url>
           </repository>
      </repositories>
 
 
        <!--        <dependency>
                    <groupId>org.apache.pdfbox</groupId>
                    <artifactId>pdfbox</artifactId>
                    <version>2.0.25</version>
                </dependency>
               <dependency>
                    <groupId>fr.opensagres.xdocreport</groupId>
                    <artifactId>org.apache.poi.xwpf.converter.xhtml</artifactId>
                    <version>1.0.6</version>
                </dependency>
               <dependency>
                    <groupId>fr.opensagres.xdocreport</groupId>
                    <artifactId>fr.opensagres.xdocreport.document</artifactId>
                    <version>2.0.2</version>
                </dependency>
                <dependency>
                    <groupId>fr.opensagres.xdocreport</groupId>
                    <artifactId>org.apache.poi.xwpf.converter.core</artifactId>
                    <version>1.0.6</version>
                </dependency>-->
 
 
 
 
 
 
    <!-- 打包使用,需要配置 -->
    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <!-- 打包時(shí)會(huì)將本地jar一起打包 -->
                <configuration>
                    <includeSystemScope>true</includeSystemScope>
                </configuration>
            </plugin>
        </plugins>
    </build>
 

?

  <!--基于 poi實(shí)現(xiàn)word數(shù)據(jù)的替換 -->
        <dependency>
            <groupId>com.deepoove</groupId>
            <artifactId>poi-tl</artifactId>
            <version>1.9.1</version>
        </dependency>

<!-- 不添加此包會(huì)提示錯(cuò)誤 :   org.openxmlformats.schemas.wordprocessingml.x2006.main.FontsDocument$Factory   -->
        <dependency>
            <groupId>fr.opensagres.xdocreport</groupId>
            <artifactId>org.apache.poi.xwpf.converter.pdf</artifactId>
            <version>1.0.6</version>
        </dependency>

<!-- 用于  word 轉(zhuǎn)pdf  -->
        <dependency>
            <groupId>fr.opensagres.xdocreport</groupId>
            <artifactId>xdocreport</artifactId>
            <version>2.0.2</version>
        </dependency>

讀取

poi-tl設(shè)置圖片(通過word模板替換關(guān)鍵字,然后轉(zhuǎn)pdf文件并下載),poi

?代碼文章來源地址http://www.zghlxwxcb.cn/news/detail-681630.html

 @GetMapping("exportPDF")
    public AjaxResult exportPDF(HttpServletResponse response) throws Exception {
        LoginUser loginUser = getLoginUser();
        OpenCompanyInfo companyInfo = openCompanyInfoService.selectEnterpriseInfo(loginUser.getId());
        if (companyInfo != null) {
            Map<String, Object> data = new HashMap<>();
            data.put("legalDeputy", companyInfo.getLegalDeputy());
            data.put("companyName", companyInfo.getCompanyName());
            data.put("companyCode", companyInfo.getCompanyCode());
            if (StringUtils.isNoneBlank(companyInfo.getBusinessLicenseUrl())) {
                InputStream businessLicenseUrl = minioClientUtils.returnInputStream(null, companyInfo.getBusinessLicenseUrl());
                data.put("businessLicenseUrl", Pictures.ofStream(businessLicenseUrl, PictureType.JPEG).size(120, 120).create());
            }
            if (StringUtils.isNoneBlank(companyInfo.getCompanyLogoUr())) {
                InputStream companyLogoUrl = minioClientUtils.returnInputStream(null, companyInfo.getCompanyLogoUr());
                data.put("companyLogoUrl", Pictures.ofStream(companyLogoUrl, PictureType.JPEG).size(120, 120).create());
            }
            InputStream inputStreamFile = ResourceReader.class.getResourceAsStream("/templates/模版.docx");
            XWPFTemplate template = XWPFTemplate.compile(inputStreamFile).render(data);
//            XWPFTemplate template = XWPFTemplate.compile("C:\\Users\\11949\\Desktop\\模版.docx").render(data);
            byte[] array = null;
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            template.writeAndClose(baos);
            array = baos.toByteArray();
            baos.close();
            template.close();
            InputStream inputStream = new ByteArrayInputStream(array);
            ByteArrayOutputStream pdfBaos = new ByteArrayOutputStream();
            XWPFDocument xwpfDocument = new XWPFDocument(inputStream);
            fr.opensagres.poi.xwpf.converter.pdf.PdfConverter.getInstance().convert(xwpfDocument, pdfBaos, PdfOptions.create());
            inputStream.close();
            xwpfDocument.close();
            response.setContentType("application/octet-stream");
            String format = DateUtil.format(new Date(), "yyyy-MM-dd");
            response.setHeader("Content-disposition", "attachment;filename=" + URLEncoder.encode("認(rèn)證授權(quán)函" + format + ".pdf", "UTF-8"));
            OutputStream out = response.getOutputStream();
            BufferedOutputStream bos = new BufferedOutputStream(out);
            pdfBaos.writeTo(bos);
            bos.flush();
            out.flush();
            PoitlIOUtils.closeQuietlyMulti(template, bos, out);
        }
        return null;
    }

到了這里,關(guān)于poi-tl設(shè)置圖片(通過word模板替換關(guān)鍵字,然后轉(zhuǎn)pdf文件并下載)的文章就介紹完了。如果您還想了解更多內(nèi)容,請?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

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

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

相關(guān)文章

  • POI-tl 知識整理:整理1 -> 利用模板向word中寫入數(shù)據(jù)
  • 使用poi-tl向word插入圖片、文本、表格行循環(huán)

    使用poi-tl向word插入圖片、文本、表格行循環(huán)

    工作中難免會(huì)向word中操作數(shù)據(jù),本文主要介紹poi-tl的使用,先來看效果圖 核心介紹: 標(biāo)簽 1、插入文本標(biāo)簽 : {{var}} 2、插入圖片標(biāo)簽: {{@var}} 操作步驟: 1、引入依賴 2、Java核心代碼 官方網(wǎng)址:http://deepoove.com/poi-tl/ 1、準(zhǔn)備模版,定義好需要的標(biāo)簽 2、查詢模版 3、獲取需要填

    2024年02月05日
    瀏覽(151)
  • java 使用POI-TL根據(jù)word模版,生成word文件,含圖片,富文本。

    java 使用POI-TL根據(jù)word模版,生成word文件,含圖片,富文本。

    1.引入mavna坐標(biāo)` 2 .poi-tl-ext插件主要用于富文本內(nèi)容格式在word展現(xiàn) 3.word模版創(chuàng)建 3.具體代碼實(shí)現(xiàn) 4.本文的miniourl路徑實(shí)質(zhì)為網(wǎng)絡(luò)路徑的文件。

    2024年02月16日
    瀏覽(20)
  • JAVA poi-tl 制作word模板 表格數(shù)據(jù)行循環(huán) 帶有復(fù)選框勾選的表格

    JAVA poi-tl 制作word模板 表格數(shù)據(jù)行循環(huán) 帶有復(fù)選框勾選的表格

    ????????java項(xiàng)目實(shí)際開發(fā)中經(jīng)常會(huì)遇到制作word表單且表格數(shù)據(jù)行循環(huán)功能,甚至帶有復(fù)選框勾選功能,本文簡單介紹如何制作模板以及使用poi-tl生成word。 提示:以下是本篇文章正文內(nèi)容,下面案例可供參考 如果只用到word那么需要導(dǎo)入的依賴如下(本案例只需要如下2個(gè)依

    2024年04月12日
    瀏覽(26)
  • POI-TL制作word

    POI-TL制作word

    本文相當(dāng)于筆記,主要根據(jù)官方文檔Poi-tl Documentation和poi-tl的使用(最全詳解)_JavaSupeMan的博客-CSDN博客文章進(jìn)行學(xué)習(xí)(上班夠用) 兩個(gè)實(shí)體類 下邊測試類 word模板 ?生成結(jié)果: ? 如果想生成柱狀圖等,按照官網(wǎng)進(jìn)行學(xué)習(xí)即可,以上兩篇(官網(wǎng),和博客學(xué)習(xí)夠用)

    2024年02月10日
    瀏覽(23)
  • poi-tl導(dǎo)出word復(fù)雜表格(單元格合并,生成復(fù)雜表格)

    poi-tl導(dǎo)出word復(fù)雜表格(單元格合并,生成復(fù)雜表格)

    官方文檔地址:http://deepoove.com/poi-tl/ 源碼地址:https://github.com/Sayi/poi-tl poi-tl(poi template language)是Word模板引擎,使用Word模板和數(shù)據(jù)創(chuàng)建很棒的Word文檔。 最近在做項(xiàng)目時(shí)候有一個(gè)關(guān)于導(dǎo)出Word的文件的需求,需要導(dǎo)出的word文件較大,并且格式比較復(fù)雜,使用poi-tl可以很好的

    2024年02月16日
    瀏覽(23)
  • Spring Boot 中使用 Poi-tl 渲染數(shù)據(jù)并生成 Word 文檔

    本文 Demo 已收錄到 demo-for-all-in-java 項(xiàng)目中,歡迎大家 star 支持!后續(xù)將持續(xù)更新! 產(chǎn)品經(jīng)理急沖沖地走了過來?!脯F(xiàn)在需要將按這些數(shù)據(jù)生成一個(gè) Word 報(bào)告文檔,你來安排下」 項(xiàng)目中有這么一個(gè)需求,需要將用戶填寫的數(shù)據(jù)填充到一個(gè) Word 文檔中,而這個(gè) Word 文檔是人家給

    2024年02月09日
    瀏覽(22)
  • java使用poi-tl導(dǎo)出word及轉(zhuǎn)換PDF后的合并導(dǎo)出pdf

    java使用poi-tl導(dǎo)出word及轉(zhuǎn)換PDF后的合并導(dǎo)出pdf

    為某單位開發(fā)的一款項(xiàng)目申報(bào)審批系統(tǒng),用戶需求在申報(bào)階段填寫的信息資料能夠?qū)С鯬DF。且項(xiàng)目申報(bào)的報(bào)告正文為用戶上傳,所以需要合并導(dǎo)出。 在項(xiàng)目初期階段使用的是PDF的預(yù)設(shè)模板導(dǎo)出,因?yàn)橐郧笆褂眠^,比較熟悉。所以優(yōu)先選擇此方法,但項(xiàng)目測試階段發(fā)現(xiàn)問題,因

    2024年02月06日
    瀏覽(33)
  • Java使用poi-tl1.9.1生成Word文檔的幾個(gè)小技巧

    Java使用poi-tl1.9.1生成Word文檔的幾個(gè)小技巧

    目錄 前言 一、poi-tl簡介 1、什么是poi-tl 2、常見的word生成對比 3、poi-tl功能點(diǎn) 二、poi-tl文檔生成 1、模板準(zhǔn)備 2、目標(biāo)參數(shù)填充 3、生成效果 ?三、可能會(huì)遇到的問題 1、混合圖表生成報(bào)錯(cuò) 2、圖表參數(shù)設(shè)置技巧 ?總結(jié) ????????也許在您的工作當(dāng)中會(huì)碰到如下的一些場景,比

    2024年02月16日
    瀏覽(24)
  • JAVA使用POI對Word docx模板文件替換數(shù)據(jù)工具類并通過瀏覽器下載到本地

    JAVA使用POI對Word docx模板文件替換數(shù)據(jù)工具類并通過瀏覽器下載到本地

    需求:需要上傳一個(gè)帶有占位符的模板至數(shù)據(jù)庫保存,然后解析模板的占位符,通過類計(jì)算結(jié)果替換模板中的占位符,并且保存至本地 難點(diǎn):1.由于我數(shù)據(jù)庫保存是本地保存,并沒有path 所以獲取模板的path是個(gè)難點(diǎn) 2.如何使用計(jì)算類,由于我的類是和占位符綁定的,什么樣的

    2024年02月16日
    瀏覽(28)

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

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

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

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

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包