Copy Worksheet not working properly

Hi,



I am trying following way to get cloned copy of an existing worksheet and start working with that copied worksheet, but I get cell count zero and no cells are seen copied to the new worksheet.
Please help on this

Workbook tempBook = new Workbook();
Worksheet lWorkSheet=tempBook.getWorksheets().get(0);
try {
this.workBook.getWorksheets().get(lSheetIndex).copy(lWorkSheet);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println(lWorkSheet.getCells().getCount)

Hi,


Well, seeing your following lines of code:


Workbook tempBook = new Workbook();
Worksheet lWorkSheet=tempBook.getWorksheets().get(0);

Actually you are creating a new workbook and get the first (default) worksheet in the workbook which is blank without any data whatsoever, so when you copy this blank worksheet to some other workbook’s sheet, it would be a blank worksheet copy without any data in it, so Cells.getCount() would be always 0 here. Mind you, getCount() method would give you 0 for empty worksheet.

Thank you.