Hi,
We are working with Apose cells java version 17.1.0.
We have observed a major data loss in the html output of the named ranges containing some hidden rows/columns.
The given problem can be easily reproduced in the html output of following named ranges in the attached excel file:
- BWY_LandscapeTable2 - Data is lost after row 2
- TestLandscape - Data is lost from row 36 to row 61
- NewTestForMichele - Data is lost after row 65
For your reference, I have also attached source excel file as well as output html files generated by Aspose.
Following is the code snippet used to generate html output:
HtmlSaveOptions htmlSaveOptions = new HtmlSaveOptions(SaveFormat.HTML);
htmlSaveOptions.setHiddenColDisplayType(HtmlHiddenColDisplayType.REMOVE);
htmlSaveOptions.setHiddenRowDisplayType(HtmlHiddenRowDisplayType.REMOVE);
Range sourceRange = workbook.getWorksheets().getRangeByName(rangeName);
Workbook newWorkbook = new Workbook(FileFormatType.XLSX);
newWorkbook.setDefaultStyle(sourceRange.getWorksheet().getWorkbook().getDefaultStyle());
WorksheetCollection targetWsc = newWorkbook.getWorksheets();
com.aspose.cells.Worksheet targetWs = (com.aspose.cells.Worksheet) targetWsc.get(0);
Range targetRange = targetWs.getCells().createRange(0, 0, sourceRange.getRowCount(), sourceRange.getColumnCount());
PasteOptions options = new PasteOptions();
options.setPasteType(PasteType.COLUMN_WIDTHS);
targetRange.copy(sourceRange, options);
int rowCount = sourceRange.getRowCount();
int firstRow = sourceRange.getFirstRow();
for (int i = 0; i < rowCount; i++) {
double rowHeight = sourceRange.getWorksheet().getCells().getRowHeight(firstRow++);
targetWs.getCells().setRowHeight(i, rowHeight);
}
options.setPasteType(PasteType.ALL);
targetRange.copy(sourceRange, options);
newWorkbook.save("c:/out.html", htmlSaveOptions);
Kindly look into this on higher priority as this issue has come up from one of our customer's production environment. Kindly note that the sensitivity of this issue is very high as it is a case of major data loss in customer's production environment.
Thanks,
Neeraj