NullReferenceException calling DeleteRow (External Data connections)

RE: Aspose.Cells .Net Version - 7.4.0.3 ( and 7.4.2 )

Our problem occurs when we attempt to strip off the data from an existing worksheet using Cells.DeleteRow with any workbook that contains an additional worksheet with external data connections. I have attached an example .xlsm file which causes the error.

Here is a listing of the code being used:

Workbook workbook = new Workbook(filePath);
Worksheet wksheet = workbook.Worksheets["Details"];
if (wksheet.ListObjects.Count > 0)
{
ListObject data = wksheet.ListObjects[0];
wksheet.Cells.DeleteRows(4, 1);
}

This feature was working with an earlier version of Aspose - 6.0.1 - but with release of Aspose.Cells .Net version 7.4.0.2, the below error results. ( I also tried with the latest - 7.4.2 which produces the same error.)

Our purpose is to strip all of the data to save a smaller template of the workbook, but for our example, we are just attempting to delete the 4th row of the "Details" worksheet containing our data when the NullReferenceException occurs. You can reproduce this error by applying the code above and processing a copy of the attached workbook .xlsm file. If you delete the worksheet with the pivot table and access to the external data connection, named "SourceData", Cells.DeleteRow works fine.


Error: Object reference not set to an instance of an object.

StackTrace:

at •Ÿ..InsertRows(Int32 , Int32 , Worksheet )
at •Ÿ..InsertRows(Int32 , Int32 , Worksheet )
at Aspose.Cells.Cells.DeleteRows(Int32 rowIndex, Int32 totalRows)
at Aspose.Cells.Cells.DeleteRows(Int32 rowIndex, Int32 totalRows, Boolean updateReference)
at AET_Play.Form1.StripDataOff(Workbook workbook) in C:\data\sourcecode\Visual Studio 2010\Projects\AET_Play\AET_Play\Form1.cs:line 476
at AET_Play.Form1.StripDataOff(String filePath) in C:\data\sourcecode\Visual Studio 2010\Projects\AET_Play\AET_Play\Form1.cs:line 430
at AET_Play.Form1.btnStripData_Click(Object sender, EventArgs e) in C:\data\sourcecode\Visual Studio 2010\Projects\AET_Play\AET_Play\Form1.cs:line 553


Please advise on what is causing this error and how to address it with the latest Aspose.Cells for .Net.

Thanks much,
-Gary

Hi,


Thanks for providing us the template file.

After an initial test, I can notice the issue and find the exception using your template file and sample code. I got the exception:
“Object reference not set to an instance of an object” on the line:
wksheet.Cells.DeleteRows(4, 1);

I have logged a ticket with an id “CELLSNET-41554” for your issue. We will look into your issue soon.

When we sort your issue out, we will let you know here.

Thank you.

Hi,

Thanks for your posting and using Aspose.Cells for .NET.

We have fixed the issue.

Please download and try this fix: Aspose.Cells for .NET v7.4.2.4 and let us know your feedback.

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


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