社区
Java SE
帖子详情
如何使用poi在已存在的excel中插入一行???
YellowSnake
2004-01-05 10:38:48
例如:在第一和第二行中插入一行???
...全文
995
2
打赏
收藏
如何使用poi在已存在的excel中插入一行???
例如:在第一和第二行中插入一行???
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
2 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
turbocrm
2004-01-06
打赏
举报
回复
跪求大家,帮我看看这个问题,谢谢!!!!!!!!!!!!!
http://expert.csdn.net/Expert/topic/2633/2633574.xml?temp=.6377375
cold_blooded
2004-01-06
打赏
举报
回复
package testz1;
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.FileOutputStream;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
public class Hello {
public Hello() {
}
public static void main(String[] args)
{
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sheet = wb.createSheet("new sheet");
HSSFRow row = sheet.createRow( (short) 0);
createCell(wb, row, (short) 0, HSSFCellStyle.ALIGN_CENTER, 1);
createCell(wb, row, (short) 1, HSSFCellStyle.ALIGN_CENTER_SELECTION, 1);
createCell(wb, row, (short) 2, HSSFCellStyle.ALIGN_FILL, 1);
createCell(wb, row, (short) 3, HSSFCellStyle.ALIGN_GENERAL, 1);
createCell(wb, row, (short) 4, HSSFCellStyle.ALIGN_JUSTIFY, 1);
createCell(wb, row, (short) 5, HSSFCellStyle.ALIGN_LEFT, 1);
createCell(wb, row, (short) 6, HSSFCellStyle.ALIGN_RIGHT, 1);
HSSFRow row2 = sheet.createRow( (short) 1);
row2.setRowNum( (short) 5);
createCell(wb, row2, (short) 0, HSSFCellStyle.ALIGN_CENTER, 2);
createCell(wb, row2, (short) 1, HSSFCellStyle.ALIGN_CENTER_SELECTION, 2);
createCell(wb, row2, (short) 2, HSSFCellStyle.ALIGN_FILL, 2);
createCell(wb, row2, (short) 3, HSSFCellStyle.ALIGN_GENERAL, 2);
createCell(wb, row2, (short) 4, HSSFCellStyle.ALIGN_JUSTIFY, 2);
createCell(wb, row2, (short) 5, HSSFCellStyle.ALIGN_LEFT, 2);
createCell(wb, row2, (short) 6, HSSFCellStyle.ALIGN_RIGHT, 2);
HSSFRow row3 = sheet.createRow( (short) 1);
createCell(wb, row3, (short) 0, HSSFCellStyle.ALIGN_CENTER, 3);
createCell(wb, row3, (short) 1, HSSFCellStyle.ALIGN_CENTER_SELECTION, 3);
createCell(wb, row3, (short) 2, HSSFCellStyle.ALIGN_FILL, 3);
createCell(wb, row3, (short) 3, HSSFCellStyle.ALIGN_GENERAL, 3);
createCell(wb, row3, (short) 4, HSSFCellStyle.ALIGN_JUSTIFY, 3);
createCell(wb, row3, (short) 5, HSSFCellStyle.ALIGN_LEFT, 3);
createCell(wb, row3, (short) 6, HSSFCellStyle.ALIGN_RIGHT, 3);
try {
FileOutputStream fileOut = new FileOutputStream("workbook.xls");
wb.write(fileOut);
fileOut.close();
}
catch (Exception e) {}
}
private static void createCell(HSSFWorkbook wb, HSSFRow row, short column,
short align, int i) {
HSSFCell cell = row.createCell(column);
cell.setCellValue(Integer.toString(i));
HSSFCellStyle cellStyle = wb.createCellStyle();
cellStyle.setAlignment(align);
cell.setCellStyle(cellStyle);
}
}
Poi
写入
EXCEL
Poi
写入
EXCEL
插入
一行
Poi
写入
EXCEL
插入
一行
Excel
添加,给指定行
插入
一行
,合并及样式
Java代码对
Excel
进行增,删,改。及样式
POI
操作
Excel
导入和导出
在企业级应用开发
中
,
Excel
报表是一种最常见的报表需求,
POI
是apache的子项目,目标是处理ole2对象。它提供了一组操纵Windows文档的Java API目前比较成熟的是HSSF接口,处理MS
Excel
(97-2002)对象。它不象我们...
poi
包
EXCEL
模板读取填数据并导出以及在模板某行
插入
新的行
NULL 博文链接:https://gojava1.iteye.com/blog/750718
利用Apache
POI
在已有的
Excel
文件
中
插入
一行
新的数据
在
POI
的第一节入门
中
,...那么在这个章节里面,我将会给大家演示一下,如何用Apache
POI
在已有的
Excel
文件
中
插入
一行
新的数据。具体代码,请看下面的例子。 [java] view plain copy print?import java.io.File; imp
Java SE
62,614
社区成员
307,326
社区内容
发帖
与我相关
我的任务
Java SE
Java 2 Standard Edition
复制链接
扫一扫
分享
社区描述
Java 2 Standard Edition
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章