Hi Aspose Team,
There is a chnage in the final step. Instead of saving the whole xls I wa nted to just save the 2nd worksheet with formula values only. Below is code snippet.
//dest.save("C:\\temp\\SOWOOD\\dest.xls");
SaveXLSFiles(dest);
//SaveXLSFiles Method
public static void SaveXLSFiles(Workbook wrkBook) throws IOException{
File outputFile = new File("C:\\temp\\SOWOOD\\dest.xls");
FileOutputStream outputstream = new FileOutputStream(outputFile);
Workbook outputWorkBook = new Workbook();
Worksheet outputSheet = outputWorkBook.getWorksheets().getSheet(0);
Worksheet templateSheet = wrkBook.getWorksheets().getSheet(1);
Cells cells = templateSheet.getCells();
Cells destCells = outputSheet.getCells();
Row sourceRow,destRow;
Cell sourceCell;
int endRow = templateSheet.getCells().getMaxDataRow();
for(Iterator it = cells.getRowIterator(); it.hasNext(); )
{
sourceRow = (Row)it.next();
if(sourceRow.getRowIndex() > endRow){
break;
}
destRow = destCells.getRow(sourceRow.getRowIndex());
for(Iterator cellIt = sourceRow.getCellIterator(); cellIt.hasNext();)
{
sourceCell = (Cell)cellIt.next();
destRow.getCell(sourceCell.getColumnIndex()).setStyle(sourceCell.getStyle());
destRow.getCell(sourceCell.getColumnIndex()).setValue(sourceCell.getValue());
}
}
outputWorkBook.save(outputstream);
}
Thanks,
rohitob