且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何创建Apache的POI 3.6新行?

更新时间:2023-12-03 20:31:29

首先,你需要开始做一个转变来完成所有的行从25下移

First you need to do move down all the rows from 25 onwards by doing a shift

sheet1.shiftRows(25, sheet1.getLastRowNum(), 5);

这将由5位下移25的所有行

this will move down all rows from 25 by 5 places

然后插入该位置的新行

row1 = sheet1.getRow(25); 
                HSSFCell cell1 = row1.createCell(0);
                cell1.setCellValue("text: The new line goes here");