Change in behavior of Cells#insertColumns starting from 25.6

Hi,

Using Aspose Cells for Java, version 25.9.

Sample code:

Workbook workbook = new Workbook("input.xlsx");
Worksheet worksheet = workbook.getWorksheets().get("IT Projections");
Cells cells = worksheet.getCells();
cells.insertColumns(3, 2);
workbook.save("output.xlsx");

In the attached zip file, you’ll find the generated result output.
‘output-25.5.xlsx’ was generated using Aspose Cells 25.5.
‘output-25.9.xlsx’ was generated using Aspose Cells 25.9.

Note the difference in styling for the inserted columns between the two versions - specifically, the borders of the cells in the inserted columns.
From trying out different Aspose Cells versions, it seems that this change in behavior was introduced in version 25.6.

Kind regards,
Taras
repro.zip (102.6 KB)

@TarasTielkes

It appears you are encountering a change in behavior with the Cells#insertColumns method in Aspose Cells for Java between versions 25.5 and 25.9. This may be related to updates in how styles are applied to newly inserted columns.

To resolve this issue, you can manually set the styles for the newly inserted columns after performing the insertion. Below is a sample code snippet that demonstrates how to do this:

Workbook workbook = new Workbook("input.xlsx");
Worksheet worksheet = workbook.getWorksheets().get("IT Projections");
Cells cells = worksheet.getCells();
cells.insertColumns(3, 2);

// Set styles for the newly inserted columns
for (int i = 3; i < 5; i++) {
    Cell cell = cells.get(i, 0); // Adjust the row index as needed
    Style style = cell.getStyle();
    style.setFontSize(12); // Example: set font size
    style.setFontName("Arial"); // Example: set font name
    cell.setStyle(style);
}

workbook.save("output.xlsx");

By applying styles to the newly inserted columns in this manner, you can ensure that they maintain the desired formatting, regardless of any changes in the library’s behavior across versions.

For further details, please consult the official Aspose documentation for the most accurate and up-to-date information.

@TarasTielkes
We have reproduced your mentioned issue that borders were not being copied.
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): CELLSJAVA-46506

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

@TarasTielkes,

We are pleased to inform you that your issue (Ticket ID: “CELLSJAVA-46506”) has been resolved. The fix/enhancement will be included in the upcoming release (Aspose.Cells v25.10) that we plan to release in the first half of October 2025. You will be notified in this thread once the new version is published.

@amjad.sahi,
That is good news. Would you mind sharing the output workbook after the fix for us to take a look at?
Thanks,
Taras

@TarasTielkes,

Alright, we will check and may prepare the output Excel file (using internal fix) to share with you for your requirements.

1 Like

@TarasTielkes
Please check the result:
result.zip (36.3 KB)

1 Like

@simon.zhao thank you!

@TarasTielkes
Thank you for your feedback. You are welcome. If you have any questions, please feel free to contact us at any time.