在 Apache POI 中打开 EXISTING xls [英] Open EXISTING xls in Apache POI

查看:29
本文介绍了在 Apache POI 中打开 EXISTING xls的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个现有文件 (C:\wb.xls),我想打开并对其进行更改.如何在 Apachie POI 中打开现有文件?我找到的所有文档都与创建新文件有关.如果您知道,如何在 xls 文件的顶部插入新行或如何自动设置列宽的格式?

I have an existing file (C:\wb.xls) that I want to open and make changes to. How in Apachie POI do you open an existing file? All the documentation that I find has to go with creating a new file. And if you know, how do you insert a new row at the top of the xls file or how to autoformat column widths?

推荐答案

使用以下之一

 XSSFWorkbook wb = new XSSFWorkbook(new FileInputStream(xlFileAddress));

 Workbook wb = WorkbookFactory.create(new File(xlFileAddress));

 Workbook wb = WorkbookFactory.create(new FileInputStream(xlFileAddress));

然后使用 wb 来创建/读取/更新您想要的工作表/行/单元格.有关详细信息,请访问此处.这肯定会对您有所帮助.

and then use wb for creating/reading/updating sheets/rows/cell whatever you want. For detail visit here. This will definitely help you.

这篇关于在 Apache POI 中打开 EXISTING xls的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆