300字范文,内容丰富有趣,生活中的好帮手!
300字范文 > word文档doc格式转换成docx

word文档doc格式转换成docx

时间:2020-04-09 21:37:15

相关推荐

word文档doc格式转换成docx

把doc格式转换成docx

jar包下载

//把doc格式转换成docx//导入 Spire.Doc.jarDocument d = new Document("F:\\**\\**\\云想.doc");d.saveToFile("F:\\**\\**\\云想.docx");

合并word文档,也是引用 Spire.Doc.jar包

/*** 合并word文档,也是引用 Spire.Doc.jar包*/public class MergeDocFile {//将2.doc合并到1里边,这是在1.doc里另开一页放的2.doc的内容。如果需要追加数据请参考spire的帮助文档,包含图片public static void mergeDoc(){String filePath1 = "F:\\exce\\doc\\云想.doc";String filePath2 = "F:\\exce\\doc\\新建 DOCX 文档.docx";Document document = new Document(filePath1);document.insertTextFromFile(filePath2, FileFormat.Docx_);document.saveToFile("F:\\exce\\doc\\云想01.doc", FileFormat.Docx_);}

合并word文档

maven 配置

在这里插入代码片<repositories><repository><id>com.e-iceblue</id><name>e-iceblue</name><url>http://repo.e-/nexus/content/groups/public/</url></repository></repositories><dependency><groupId> e-iceblue </groupId><artifactId>spire.doc</artifactId><version>3.2.3</version></dependency><dependency><groupId>e-iceblue</groupId><artifactId>spire.doc.free</artifactId><version>2.7.3</version></dependency>

在这里插入代码片/*** 合并doc* @param fileList文件路径* @param newFilePath合并后新文件路径* @throws Exception*/public static void mergeDoc(List<String> fl, String newFilePath) throws Exception {try{Document document = new Document();//创建空白页(可不创建,用Document document = new Document("文件路径"))document.createMinialDocument();//合并文档for(String path : fl){document.insertTextFromFile(path, FileFormat.Docx_);}//保存文档document.saveToFile(newFilePath, FileFormat.Docx_);}catch(Exception e){e.printStackTrace();}}

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。