Aspose Cells.DeleteRange() bug


#1

Hi,

I ran into an issue with the Cells.DeleteRange() method where deleting a range doesn’t preserve the groupings of my worksheet correctly. Deleting a few rows of data causes my groupings to be offset beyond the point of deletion, and this compromises the groupings that were made on the worksheet. This is a source of problems, since the groups are integral to our use of the worksheets. I would appreciate it if you kindly looked into this matter. Thank you.

Best regards,
YJ


#2

@yaash45,

Thanks for providing us some details.

Please perform you task manually in Ms Excel by opening the workbook into it. If you find something different than what Aspose.Cells does, kindly create a simple console application using our latest version/fix v19.7.x, zip the project and post us, we will check it soon. Also attach your sample files (input file(if any) and output file), this will helps us really to evaluate your issue precisely to consequently figure it out soon.


#3

Hi,

I have compared the functionality of doing this in Ms Excel, and I am attaching screenshots of the input workbook, output using Aspose and desired output using Excel for your reference. The program deletes rows 15-17 and the grouping doesn’t adjust according to the deletion in Aspose, but does so in Excel. I hope this helps you understand the issue better. Thanks.

aspose_output.PNG (5.2 KB)
desired_output.PNG (5.2 KB)
original_input.PNG (5.4 KB)

The code that I ran is something like:

worksheet.GetRange(15, 1, 17, 1).EntireRow.Delete();

Best,
YJ


#4

@yaash45,
Could you please share your input and output file and code snippet (runnable) for our testing. We will reproduce the problem and provide our feedback after analysis.


#5

Hi,

I am attaching a zip file of the workbooks, along with the code snippet below. The workbook called test.xlsx is the input workbook and should you decide to run the code, it should live on your desktop. The output workbook is named aspose_output.xlsx and the desired output workbook is called desired_output.xlsx.

The exact code that I ran is this:

using System;
using Aspose.Cells;

namespace DeleteRangeIssue
{
    public class Program
    {
        static void Main(string[] args)
        {
            string filePath = $"{Environment.GetFolderPath(Environment.SpecialFolder.Desktop)}/test.xlsx";
            string outfilePath = $"{Environment.GetFolderPath(Environment.SpecialFolder.Desktop)}/testOutput.xlsx";

            Workbook workbook = new Workbook(filePath);

            Worksheet worksheet = workbook.Worksheets[0];

            Range rangeToDelete = workbook.Worksheets.GetRangeByName("deleteRange");

            int startRow = rangeToDelete.FirstRow;
            int endRow = rangeToDelete.FirstRow + rangeToDelete.RowCount - 1;

            int startCol = rangeToDelete.FirstColumn;
            int endCol = rangeToDelete.FirstColumn + rangeToDelete.ColumnCount - 1;

            worksheet.Cells.DeleteRange(startRow, startCol, endRow, endCol, ShiftType.Up);

            workbook.Save(outfilePath);
        }
    }
}

I hope this sheds some light on the issue and helps you investigate this better. Thank you.

Attachment: aspose delete issue.zip (19.7 KB)

Best,
YJ


#6

@yaash45,
We were able to observe the issue but we need to look into it more. We have logged the issue in our database for investigation and for a fix. Once, we will have some news for you, we will update you in this topic.

This issue has been logged as

CELLNET-46850 – Data grouping not preserved while using Cells.DeleteRange()

#7

@yaash45,
This is to inform you that we have fixed your issue (logged earlier as “CELLNET-46850”) now. We will soon provide you the fixed version after performing QA and incorporating other enhancements and fixes.


#8

@yaash45,

Please try our latest version/fix: Aspose.Cells for .NET v19.7.5 (attached)

Your issue “CELLSNET-46850” should be fixed in it.

Let us know your feedback.
Aspose.Cells19.7.5 For .Net2_AuthenticodeSigned.Zip (4.9 MB)
Aspose.Cells19.7.5 For .Net4.0.Zip (4.9 MB)


#9

The issues you have found earlier (filed as CELLSNET-46850) have been fixed in Aspose.Cells for .NET v19.8. This message was posted using BugNotificationTool from Downloads module by Amjad_Sahi