Results 1 to 2 of 2
- 01-28-2013, 08:23 AM #1
Member
- Join Date
- Jan 2013
- Posts
- 4
- Rep Power
- 0
Data getting overwritten in excel using apache poi.. need to get appended in next row
Hai,
How to go to next row and print the data in excel using java apache poi.. instead of overwritting existing data..
below is the code i have written pls correct
private static void excelLog(int row, int col, String value)
{
HSSFRow myRow = mySheet.getRow(row);
if (myRow == null)
{
myRow = mySheet.createRow(row);
}
/*else
{
Iterator<Row> rowIterator = mySheet.iterator();
while(rowIterator.hasNext()) {
myRow = mySheet.createRow(row);
}*/
}
HSSFCell myCell = myRow.createCell(col);
myCell.setCellValue(value);
}
public void writeDataExcel(ArrayList<String> inpList) {
int numCol = 100;
int index = 0;
for (int i = 0; i < 100; i++) {
for (int j = 0; j < numCol; j++) {
if(index < inpList.size())
excelLog(i, j, inpList.get(index++));
}
}
- 01-28-2013, 11:00 AM #2
Moderator
- Join Date
- Apr 2009
- Posts
- 10,484
- Rep Power
- 16
Similar Threads
-
want to extract the text data from ppt and store in excel using apache poi
By s.arun316@gmail.com in forum Apache POIReplies: 1Last Post: 01-24-2013, 09:30 AM -
Apache POI not able to evaluate table names in the Excel Sheet
By saritha suram in forum Apache POIReplies: 5Last Post: 08-02-2012, 12:55 PM -
Excel to Html Conversion using apache poi library
By agastheswar in forum New To JavaReplies: 1Last Post: 03-17-2012, 01:58 PM -
Generate Excel using Apache POI
By sarwan in forum New To JavaReplies: 0Last Post: 06-08-2010, 11:17 AM -
Adding multiple sheets in Excel (apache POI)
By javanewbie in forum Advanced JavaReplies: 0Last Post: 06-22-2009, 04:51 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks