Manually Deleting Row 0 - "Index was outside the bound of the array"

Hello again. Using the v9.0.1.0 dll for .NET provided by my previous issue, I am seeing an exception when trying to delete Row 0 from a xlsx file that definitely has content on rows AFTER 0, but row 0 is blank.

Using the attached data, simply call

worksheet.Cells.DeleteRow(0)

and then attempt to Render or Save, and you will get "Index was outside the bound of the array"

If you put data in a cell on row 0 and repeat this code, it will work fine. Calling delete on any blank row after 0 also works fine. Calling worksheet.Cells.DeleteBlankRows correctly removes row 0 and has no problems, however.

As a secondary item, I’m only manually deleting rows because both DeleteBlankRows and DeleteBlankColumns seem to delete merged cells that may not have their own value, but are actually being used to display text. In the same file, observe the merged range from from C10 to I17. Load the sheet and call DeleteBlankRows and/or DeleteBlankColumns, then render to image - the text will be cut off accordingly.

My work around for this has been to iterate through all rows and columns, using the IsBlankColumn and Row.IsBlank functions to see if Aspose thinks something is blank, and if it returns true, check that row/column fora single cell that returns true for CurrCell != null && (CurrCell.IsMerged || CurrCell.Value != null) - I’m not yet sure if IsInTable or IsInArray are also necessary.

Hi Corey,


Thank you for sharing the sample.

We have evaluated the presented scenario while using the latest version of Aspose.Cells for .NET 9.0.1 and following piece of code, however, we are not able to observe any exception during the process. Please be kind enough to share an executable sample application to replicate the problem on our side, then we will be in a better position to assist you with it.

C#

var book = new Workbook(dir + “BreakCase.xlsx”);
var sheet = book.Worksheets[0];
sheet.Cells.DeleteRow(0);
book.Save(dir + “output.xlsx”);
SheetRender render = new SheetRender(sheet, new ImageOrPrintOptions());
render.ToImage(0, dir + “output.png”);

I have attached picture of code and exception as they occur in VS2015. It looks we are doing the exact same operations. I also tested with 8.9.0 just to be certain, same results.


My application is built for .NET 4.0, and the issue is consistent in both release and debug modes. I currently have Microsoft Excel 2010 installed. I verified that the file I attached to the original post causes this issue on my machine.

Let me know what other relevant information I can provide - I will be back online in about 8 hours.

Hi again,


Thank you for sharing the snapshot, however, it would have been more appropriate to post you sample application. Please note, you have to create an archive (.zip) of all project files before attaching it to the forum post.

Anyway, I have given this scenario another try on my side by changing the target .NET Framework to 4.0 (previously I tested it against 4.6.1) but still I am not able to replicate the issue on my side. Please confirm that we are operating on same spreadsheet by downloading the sample from this thread. In case the problem persists, please share the sample application along with all dependencies as well as your environment details as follow.

  • Operating system version & architecture.
  • Locale/Region of the machine.

Sample project that reproduces issue on my machine attached. Verified that it is the same file as in original post.


OS Name: Microsoft Windows 7 Enterprise
OS Version: 6.1.7601 Service Pack 1 Build 7601
System Type: x64-based PC
System Locale: en-us;English (United States)

Hi Corey,


Thank you for sharing the sample project.

We have managed to replicate the said exception while using your provided sample project in Windows 7 x64. In order to further investigate the matter, a ticket with Id CELLSNET-44760 has been logged in our database. Please spare us little time for the properly analysis of said scenario. In the meanwhile, we will keep you posted with updates in this regard.
Hi,

Thanks for using Aspose.Cells.

Please download and try the latest fix: Aspose.Cells for .NET v9.0.9.0 and let us know your feedback.

No problems with the new DLL, thank you very much.

Hi,


Good to know that your issue is sorted out by the new fix/version. Feel free to contact us any time if you need further help or have some other issue or queries, we will be happy to assist you soon.

Thank you.

The issues you have found earlier (filed as CELLSNET-44760) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

The issues you have found earlier (filed as CELLSNET-44760) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.
(2)