"Object reference not set to an instance of an object" when copying a sheet with a text box

Hi,


I have a worksheet that includes a text box. When I copy it to a new workbook it copies fine. When I try to duplicate the version in the new workbook I get the following error:

Object reference not set to an instance of an object.
at Aspose.Cells.Drawing.FillFormat.(FillFormat , CopyOptions ) at Aspose.Cells.Drawing.LineFormat.(LineFormat , CopyOptions ) at Aspose.Cells.Drawing.ShapeFormat.(ShapeFormat , CopyOptions ) at Aspose.Cells.Drawing.Shape.(Shape , CopyOptions ) at Aspose.Cells.Drawing.TextBox.(TextBox , CopyOptions ) at Aspose.Cells.Drawing.ShapeCollection.(Shape , GroupShape , CopyOptions ) at Aspose.Cells.Drawing.ShapeCollection.(ShapeCollection , CopyOptions ) at Aspose.Cells.Worksheet.(Worksheet , CopyOptions ) at Aspose.Cells.Worksheet.Copy(Worksheet sourceSheet, CopyOptions copyOptions) at Aspose.Cells.Worksheet.Copy(Worksheet sourceSheet) at MyCode in C:\TEST\sourcecode.vb:line 14

The error occurs when I try to copy the copy of the original sheet. Here is the code I am running:

‘’ Copy sheet from original workbook into a new workbook
Dim loOrigWB As New Aspose.Cells.Workbook(“C:\Test\Broken Text Box.xlsx”)
Dim loOrigDefn As Aspose.Cells.Worksheet = loOrigWB.Worksheets(“Defn”)
Dim loNewWB As New Aspose.Cells.Workbook()
loNewWB.Worksheets.Insert(0, Aspose.Cells.SheetType.Worksheet).Copy(loOrigDefn)
loOrigDefn = Nothing
loOrigWB = Nothing

‘’ Create copy of the new sheet within same workbook
Dim loNewDefn As Aspose.Cells.Worksheet = loNewWB.Worksheets(0)
loNewWB.Worksheets.Insert(0, Aspose.Cells.SheetType.Worksheet).Copy(loNewDefn)

I have attached the workbook with the issue. If I remove the text box the issue goes away.

Your assistance with this issue is greatly appreciated.

Thanks, Julie



Hi,


Thanks for your posting and using Aspose.Cells.

We were able to observe this issue and logged it in our database for an investigation and for a fix.

This issue has been logged as

  • CELLSNET-45386 - Object reference not set to an instance of an object - when copying a sheet with a text box

Hi,


This is to inform you that we have fixed your issue “CELLSNET-45386 now. We will soon provide the fix after performing QA and including other enhancements and fixes. The fix can be available in the next 3-5 days or so.

Thank you.
Hi,

Thanks for using Aspose.Cells.

Please download and try the following latest fix

Aspose.Cells for .NET v17.5.5 (.NET 4.0) compiled in .NET Framework 4.0.

and let us know your feedback.

Thank you for your prompt reply and fix. Unfortunately we are still using .NET 2.0 and so I am unable to try the latest fix.


Thanks, Julie

Hi,


Thanks for your posting and using Aspose.Cells.

The fix works fine as per my testing with your sample code and sample Excel file but we are afraid, .NET 2.0 version is not available at the moment.

We have therefore logged a request for it in our database for product team. Once, the .NET 2.0 version will be available for you, we will let you know asap by posting a download link in this thread.

Hi,


Thanks for using Aspose.Cells.

.NET 2.0 version is now available. Here are the links for your reference. Hopefully, your issue will be resolved with it.

Download Links:
Aspose.Cells for .NET v17.5.7 (.NET 2.0) compiled in .NET Framework 2.0.
Aspose.Cells for .NET v17.5.7 (.NET 4.0) compiled in .NET Framework 4.0.

The issues you have found earlier (filed as CELLSNET-45386) have been fixed in Aspose.Cells for .NET 17.6.


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

The issues you have found earlier (filed as CELLSNET-45386) have been fixed in Aspose.Cells for .NET 17.6.


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