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