概述
I have two xlsx files at folder C:DemoFilesExceldemo1.xlsx and C:DemoFilesExceldemo2.xlsx.
I want to create a new xlsx C:DemoFilesExcelmerged.xlsx that will have these two files as two sheets in merged.xlsx workbook.
This is to be done using apache POI in java. Any idea how to do
解决方案
//Open the first excel file.
Workbook SourceBook1 = new Workbook("F:\Downloads\charts.xlsx");
//Define the second source book.
//Open the second excel file.
Workbook SourceBook2 = new Workbook("F:\Downloads\picture.xlsx");
//Combining the two workbooks
SourceBook1.combine(SourceBook2);
//Save the target book file.
SourceBook1.save("F:\Downloads\combined.xlsx");
最后
以上就是甜蜜花瓣为你收集整理的java合并excel文件,在Java中的一个工作簿中将两个Excel文件合并为两个表的全部内容,希望文章能够帮你解决java合并excel文件,在Java中的一个工作簿中将两个Excel文件合并为两个表所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复