社区
Java SE
帖子详情
POI读取EXCEL
kong2010
2005-04-06 04:02:02
如何用POI读取一个不知行数、不知列数的EXCEL表。
...全文
99
2
打赏
收藏
POI读取EXCEL
如何用POI读取一个不知行数、不知列数的EXCEL表。
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
2 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
richard1295
2005-04-22
打赏
举报
回复
一个操作excel的例子,看对你有帮助否
package excel;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFCell;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
public class ReadWriteWorkbook
{
public static void main(String[] args)
throws IOException
{
POIFSFileSystem fs =
new POIFSFileSystem(new FileInputStream("d:\\foo.xls"));
HSSFWorkbook wb = new HSSFWorkbook(fs);
wb.removeSheetAt(2);
HSSFSheet sheet = wb.getSheetAt(0);
sheet.setColumnWidth((short)200,(short)500);
HSSFRow row = sheet.getRow(2);
if (row == null)
row = sheet.createRow(2);
HSSFCell cell = row.getCell((short)3);
if (cell == null)
cell = row.createCell((short)3);
cell.setCellType(HSSFCell.CELL_TYPE_STRING);
cell.setCellValue("asafasfsafasfsfaas test");
// Write the output to a file
FileOutputStream fileOut = new FileOutputStream("d:\\ffoo.xls");
wb.write(fileOut);
fileOut.close();
}
}
kong2010
2005-04-06
打赏
举报
回复
顶。
用POI可以用sheet.rowIterator();取得行数,但怎么取得列数呢?
利用
POI
读取
excel
写入到word
利用
POI
读取
excel
写入到word 利用
POI
读取
excel
写入到word 利用
POI
读取
excel
写入到word,压缩包里包含了jar包
POI
读取
excel
的内容.zip
JAVA IO操作
POI
读取
excel
的内容
poi
读取
excel
所需jar包,需要的自取
poi
读取
excel
所需jar包,可用来使用
poi
读写word
excel
。
poi
读取
excel
并输出到jsp页面
poi
读取
excel
并输出到jsp页面
POI
读取
Excel
POI
读取
Excel
Java SE
62,614
社区成员
307,327
社区内容
发帖
与我相关
我的任务
Java SE
Java 2 Standard Edition
复制链接
扫一扫
分享
社区描述
Java 2 Standard Edition
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章