java 如何使用poi合并两个excel工作簿?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5008572/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to combine two excel workbooks using poi?
提问by Alex Korotkikh
I have to HSSFWorkbook objects, each of them contains one or more HSSFSheet. How can I get one workbook with sheets from both of these objects? POI 3.6
我有 HSSFWorkbook 对象,每个对象都包含一个或多个 HSSFSheet。如何从这两个对象中获取一个带有工作表的工作簿?兴趣点 3.6
回答by JoseK
There are two code examples on the below thread - one of them is fully working as per comments, but I havent tried this one myself yet. Note, it's an old link, so the API might not match Poi 3.6
下面的线程中有两个代码示例——其中一个完全按照评论工作,但我自己还没有尝试过这个。请注意,这是一个旧链接,因此该 API 可能与 Poi 3.6 不匹配
http://www.coderanch.com/t/420958/open-source/Copying-sheet-excel-file-another
http://www.coderanch.com/t/420958/open-source/Copying-sheet-excel-file-another
Create a new Workbook and copy over sheets from both existing workbooks using the above
创建一个新工作簿并使用上述方法从两个现有工作簿中复制工作表