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++));
}
}
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++));
}
}