InsertCutCells is causing unexpected conditional formatting changes

Hi, I’m using the latest version Aspose.Cells for .Net (24.6.0) and when I use InsertCutCells to move worksheet columns, the conditional formatting of the worksheet becomes distorted. For reference, please see rows 42 to 53 in attached file ‘TestAsposeFormatting - Result’.
(Note that this issue seems to have been introduced in Aspose.Cells v 22.0 onwards as it works fine with v21.9)

The code I’m using is as follows:

        public void GroupQuarters(Workbook wb)
        {
            // Move quarter groups
            var worksheet = wb.Worksheets["Test"];

            var rangeOriginalColumn = 7;
            var insertColumn = 3;

            while (rangeOriginalColumn <= 62)
            {
                Aspose.Cells.Range cutRange = GetRange(worksheet,
                                    startRowIndex: 1,
                                    startColumnIndex: rangeOriginalColumn,
                                    endRowIndex: 91,
                                    endColumnIndex: rangeOriginalColumn + 4 - 1);

                var destRange = GetRange(worksheet, 1,insertColumn, 91, insertColumn);

                Cut(sourceRange: cutRange,
                    destinationRange: destRange,
                    insertColumn);

                insertColumn = insertColumn + 4;
                rangeOriginalColumn = rangeOriginalColumn + 5;
            }

            var resultWorkbookPath = Path.Combine(Path.GetDirectoryName(wb.FileName), Path.GetFileNameWithoutExtension(wb.FileName)) + $" - Result.xlsx";
            var fullResultFileName = Path.ChangeExtension(resultWorkbookPath, ".xlsx");
            Directory.CreateDirectory(Path.GetDirectoryName(resultWorkbookPath));
            wb.Save(fullResultFileName, SaveFormat.Xlsx);
        }

        public Aspose.Cells.Range GetRange(Aspose.Cells.Worksheet worksheet, int startRowIndex, int startColumnIndex, int endRowIndex, int endColumnIndex)
        {
            Aspose.Cells.Range range = worksheet.Cells.CreateRange(
                firstRow: startRowIndex - 1,
                firstColumn: startColumnIndex - 1,
                totalRows: endRowIndex - startRowIndex + 1,
                totalColumns: endColumnIndex - startColumnIndex + 1);
            return range;
        }

        public void Cut(Aspose.Cells.Range sourceRange, Aspose.Cells.Range destinationRange, int insertColumn)
        {
            Aspose.Cells.Worksheet destinationWorksheet = destinationRange.Worksheet;

            destinationWorksheet.Cells.InsertCutCells(
                sourceRange,
                0,
                insertColumn - 1,
                ShiftType.Right
            );
        }

Could you please help resolve this? Thanks in advance!
TestAsposeFormatting.zip (100.5 KB)

@AvneetK
By using sample file and code for testing on the latest version v24.6, we can reproduce the issue. Discovered conditional formatting error after calling the Cells.InsertCutCells method.

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): CELLSNET-56015

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.

@AvneetK
We are pleased to inform you that your issue (“CELLSNET-55973”) has been resolved. The fix will be included in the next release (Aspose.Cells v24.7). You will be notified when the next version is released.
Please check the attached file generated by 24.6.1:
24.6.1 (2).zip (48.2 KB)

1 Like

Thank you for the quick response!

@AvneetK,

You are welcome. You can expect the new version in the second week of July next month. Stay tuned!

The issues you have found earlier (filed as CELLSNET-56015) have been fixed in this update. This message was posted using Bugs notification tool by johnson.shi