Aspose-Words文档处理类库
简介
Aspose.Words for Java is a class library that enables your applications to perform a great range of document processing tasks. Aspose.Words supports DOC, DOCX, RTF, HTML, OpenDocument, PDF, XPS, EPUB and other formats. With Aspose.Words you can generate, modify, convert, render and print documents without using Microsoft Word®.
官网文档: https://docs.aspose.com/display/wordsjava/Home
官网代码示例: https://github.com/aspose-words/Aspose.Words-for-Java.git
同类别软件: Apache POI
注:
- Aspose需要商业授权,POI开源免费
- 对于简单的文档关键字替换使用POI
- 复杂的表格编辑,使用Aspose中的标签替换
- 对于替换参数(数字,文本,表格,图片等),可封装替换参数,增强代码的适用性
代码示例
Java类库
Maven
<dependency> <groupId>com.aspose</groupId> <artifactId>aspose-words</artifactId> <version>19.5</version> <classifier>jdk17</classifier> </dependency>
直接引入Jar
aspose-words-19.5-jdk17.jar
简单示例
加载license
try { License license = new License(); license.setLicense("Aspose.Words.lic"); System.out.println("License set successfully."); } catch (Exception e) { System.out.println("There was an error setting the license: " + e.getMessage()); }
Word->PDF
File file = new File("/Test-01.docx"); Document document = new Document(new FileInputStream(file)); PdfSaveOptions pdfSaveOptions = new PdfSaveOptions(); pdfSaveOptions.getOutlineOptions().setHeadingsOutlineLevels(5); OutputStream outputStream = new FileOutputStream("/Test-01.pdf"); document.save(outputStream,pdfSaveOptions);
书签文本替换
document.getRange().getBookmarks().get(bookMakeName).setText(word);
低调大师中文资讯倾力打造互联网数据资讯、行业资源、电子商务、移动互联网、网络营销平台。
持续更新报道IT业界、互联网、市场资讯、驱动更新,是最及时权威的产业资讯及硬件资讯报道平台。
转载内容版权归作者及来源网站所有,本站原创内容转载请注明来源。
- 上一篇
【从入门到放弃-MySQL】数据库连接过程分析-客户端
前言 上文分析了【从入门到放弃-MySQL】数据库连接过程分析。本文我们一起来追一下客户端和服务端建联的过程。这里客户端使用JDBC8.0,在SpringBoot2.1.3下验证。 请求流程 初始化 SpringBoot2.1.3默认使用的HickriCP连接池 应用启动时,会先注册spring.datasource.driver-class-name配置的驱动,这里我们使用com.mysql.cj.jdbc.Driver 启动后,我们直接通过一个查询操作的http请求来验证一次查询操作中,客户端与服务端连接的过程 首次请求 当使用到Dao请求时,开始建立连接调用堆栈如下: checkErrorMessage:752, NativeProtocol (com.mysql.cj.protocol.a) checkErrorMessage:741, N
- 下一篇
Java并发编程,深度探索J.U.C - AQS
java.util.concurrent(J.U.C)大大提高了并发性能,AQS 被认为是 J.U.C 的核心。 CountdownLatch用来控制一个线程等待多个线程。 维护了一个计数器 cnt,每次调用 countDown() 方法会让计数器的值减 1,减到 0 的时候,那些因为调用 await() 方法而在等待的线程就会被唤醒。public class CountdownLatchExample { public static void main(String[] args) throws InterruptedException { final int totalThread = 10; CountDownLatch countDownLatch = new CountDownLatch(totalThread); ExecutorService executorService = Executors.newCachedThreadPool(); for (int i = 0; i < totalThread; i++) { executorService.execut...
相关文章
文章评论
共有0条评论来说两句吧...
文章二维码
点击排行
推荐阅读
最新文章
- Hadoop3单机部署,实现最简伪集群
- CentOS8编译安装MySQL8.0.19
- CentOS7编译安装Cmake3.16.3,解决mysql等软件编译问题
- Windows10,CentOS7,CentOS8安装MongoDB4.0.16
- SpringBoot2整合MyBatis,连接MySql数据库做增删改查操作
- SpringBoot2整合Thymeleaf,官方推荐html解决方案
- Eclipse初始化配置,告别卡顿、闪退、编译时间过长
- Springboot2将连接池hikari替换为druid,体验最强大的数据库连接池
- Mario游戏-低调大师作品
- CentOS6,CentOS7官方镜像安装Oracle11G