Using Aspose Cells for Java, version 19.12.2.
A common case in our application is to populate ranges/tables with external data, i.e. the results of a query performed on a database.
Typically we use a template workbook, that specifies the styles and formatting for a single record. For each additional record, we perform the following:
- insert an additional row
- copy the contents of the previous row, to apply styles, formatting and calculation formulas operating on the row data for the newly inserted record
We have found out that, if we know the number of records/rows to be inserted beforehand, it makes a huge difference (in terms of performance) to insert the new rows in bulk. Specifically, instead of calling
Cells#insertRows(rowIndex, totalRows) for each row, we call the method once with the total amount of additional rows that we want to insert. In the case where there are many formulas present in the workbook that operate on the inserted rows, this batching optimization seems to make a large difference in performance when using Aspose Cells.
However, in addition to inserting new rows, we also want to copy styles, formatting and formulas to each of the inserted rows. Typically, we have a number of columns with formulas that calculate relevant data for each record/row inserted. At the moment, we are using
Cells#copyRow(sourceCells, sourceRowIndex, destinationRowIndex) for each additional row populated by the database query.
When we know that we are inserting 100.000 new rows, calling this method 100.000 times seems clumsy. What we want to express to Aspose Cells is “copy this single row N times, starting at destination row X”. It seems that there is an opportunity for a more convenient API here. In addition, there should be some potential for a performance improvement: since Aspose Cells will know that I want to copy a given row N times, it will need to read the source row only once, instead of reading it N times when using the current API.
In essence, this feature request is to introduce a method like the following on the
public void copyRow(Cells sourceCells, int sourceRowIndex, int destinationRowIndex, int rowCount);
The method will copy the source row, “pasting” it rowCount times to the rows starting from the specified destination row.
Given the tabular nature of typical Excel workbooks, I think this is quite a common use case. It could be optimized for, both in terms of API usability, as well as performance.
I hope the feature request is clear, and makes sense. If you have any questions, please ask.