I am using Aspose 8.1.0
When I try to generate the XML output using SpreadsheetML2003SaveOptions, it has been observed that empty cells are missing in the generated XML.
For your reference, I have attached the xlsx file being used and the XML output generated by Aspose.
Following is the code snippet for the same:
Workbook workbook = new Workbook(“C:/187208/TestDoc_1.xlsx”);
com.aspose.cells.Worksheet selectedWorksheet = workbook.getWorksheets().get(“table1”);
//Create Range
Range sourceRange = selectedWorksheet.getCells().createRange(“A1:G3”);
Workbook targetWorkbook = new Workbook(FileFormatType.XLSX);
WorksheetCollection targetWsc = targetWorkbook.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.ALL);
targetRange.copy(sourceRange, options);
File xmlFile = new File(“C:/187208/AposeGenerated.xml”);
SpreadsheetML2003SaveOptions spreadsheetML2003SaveOptions = new SpreadsheetML2003SaveOptions(SaveFormat.SPREADSHEET_ML);
targetWorkbook.save(xmlFile.getAbsolutePath(), spreadsheetML2003SaveOptions);
You can observer in the output, for the second row there is only one cell whereas it should have 7 cells and for the third row there are only two cells whereas it should have 7. Missing cells are leading to wrong placement of the data.
Character formatting
Test firs cell data
and last
but one
Thanks,
Neeraj