I am using Aspose.cells 7.7.1 to copy contents of one excel file to other. While doing the same I noticed copyRows() function is unable to copy sparklines from one sheet to other
Following code snippet can be used to debug:
//Open a template file
Workbook book = new Workbook(“d:\files\sparkline_input1.xlsx”);
Workbook book2 = new Workbook(“d:\files\sparkline_input2.xlsx”);
//Get the first worksheet
Worksheet sheet = book2.getWorksheets().get(0);
Cells cells, sourcecells;
cells = book.getWorksheets().get(0).getCells();
sourcecells = sheet.getCells();
// copy book2’s contents to book’s sheet at the end
cells.copyRows(sourcecells,
0,
cells.getMaxDisplayRange().getRowCount() + 2,
sourcecells.getMaxDisplayRange().getRowCount());
//Save the excel file
book.save(“d:\files\sparkline_output.xlsx”);
I have attached input files for your reference.
I even tried using Aspose.cells 8.2.2.jar as well, issue still persists.
Thanks for providing us template files and sample code.
After an initial test, I observed the issue as you mentioned by using your sample code
with your template files. I found Cells.copyRows() method is not copying
sparklines in the XLSX file format.
e.g
Sample code:
//Open a template file
Workbook book = new Workbook("sparkline_input1.xlsx");
Workbook book2 = new Workbook("sparkline_input2.xlsx");
//Get the first worksheet
Worksheet sheet = book2.getWorksheets().get(0);
// copy book2's contents to book's sheet at the end
cells.copyRows(sourcecells,
0,
cells.getMaxDisplayRange().getRowCount() + 2,
sourcecells.getMaxDisplayRange().getRowCount());
//Save the excel file
book.save("outsparkline_output.xlsx");
I have logged a ticket with an id "CELLSJAVA-41056" for your issue. We will look into it soon.
Once we have any update on it, we will let you know here.
We have fixed
this issue now. We will provide you a fix in couple of days after
incorporating other enhancements and fixes and conducting some extensive
testing. Once, it is available for you, we will let you know asap by
posting in this thread.
It is good to know that your issue is resolved with the latest version. Let us know if you encounter any other issue, we will be glad to look into it and help you further.