Hi Jhonson,
Thank you for you quick response. Specifying the file format type resolved the issue.
But now I am getting Nullpointerexception in following code part
// get the template worksheet for the leaf node provided.
Worksheet templateWorksheet = templateWorkbook.getWorksheets().getSheet(leafNode.getTabType());
// add a new worksheet in the target workbook.
Worksheet targetWorksheet = targetWorkbook.getWorksheets().addSheet();
// copy the contents of template worksheet to added worksheet.
targetWorksheet.copy(templateWorksheet);
// change the name of added worksheet.
targetWorksheet.setName(leafNode.getShortTabName());
ExcelDebugUtil.logExcel(targetWorksheet.getWorkbook(),"c:/targetWorksheet.xlsx",FileFormatType.EXCEL2007);
// get all the named ranges from the worksheet.
NamedRange[] namedRanges = targetWorksheet.getNamedRanges();
I am getting namedRanges as null, in the saved targetWorksheet.xlsx I am not getting named range which is there in templateworksheet.
Please help.
Thank You.
Kailas