We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

System.NullReferenceException on opening the source Excel file - fixed

Hello team,

I have conveted PQ4236.xlsx to PDF with Aspose.Cells 17.7. However ‘System.NullReferenceException’ happens in new Workbook(this.stream).

PQ4236.zip (129.5 KB)

This is my code.

   private MemoryStream ConvertExcelToPdf()
    {
        MemoryStream pdfStream = new MemoryStream();

        // Instantiate the License class
        Aspose.Cells.License license = new Aspose.Cells.License();
        license.SetLicense("Aspose.Total.lic");

        // Convert .xls and .xlsx file to PDF.
        Workbook book = new Workbook(this._stream);
        book.Save(pdfStream, Aspose.Cells.SaveFormat.Pdf);

        return pdfStream;
    }

Thank you,
PFU DSOL2

@PFU.DSOL2

Thanks for using Aspose API.

We were able to observe this issue and logged it in our database for investigation and for a fix. Once, the issue is resolved or we have some other news for you, we will let you know asap.

This issue has been logged as

  • CELLSNET-45550 - System.NullReferenceException on opening the source Excel file

C#

Workbook wb = new Workbook("PQ4236.xlsx");

Exception

System.NullReferenceException was unhandled
  HResult=-2147467261
  Message=Object reference not set to an instance of an object.
  Source=Aspose.Cells
  StackTrace:
       at     . (      , WorksheetCollection  , Hashtable  , Boolean  )
       at     . (      , Int32  ,       )
       at     . (      )
       at     . (      ,       )
       at     .  ()
       at     . ()
       at     . (Workbook  , LoadOptions  )
       at   . (Object  )
       at   . (MethodBase  , Boolean  )
       at   .   (   )
       at   .  ()
       at   . ()
       at   . (Object  )
       at   .  ()
       at   . (Object  , UInt32  )
       at   . ()
       at   . ()
       at   . ()
       at   . (Object  )
       at   .  ()
       at   . (Object  , UInt32  )
       at   . ()
       at   . (Object[]  , Type[]  , Type[]  , Object[]  )
       at   . (Int32  , Type[]  , Type[]  , Boolean  )
       at   .   (   )
       at   .  ()
       at   . ()
       at   . (Object  )
       at   .  ()
       at   .  (   )
       at   .  ()
       at   . ()
       at   . (Object  )
       at   .  ()
       at   . (Object  , UInt32  )
       at   . ()
       at   . ()
       at   . ()
       at   . (Object  )
       at   .  ()
       at   . (Object  , UInt32  )
       at   . ()
       at   . (Object[]  , Type[]  , Type[]  , Object[]  )
       at Aspose.Cells.Workbook. (String  , LoadOptions  )
       at Aspose.Cells.Workbook..ctor(String file)
       at CellsNet.Program.f1() in

@PFU.DSOL2,

We are pleased to inform you that we have fixed your issue (logged earlier as “CELLSNET-45550”) now. We will soon provide you the fix in the next few days (2-3 days) after performing QA and incorporating other enhancements and fixes.

Thank you.

The issues you have found earlier (filed as CELLSNET-45550) have been fixed in latest version Aspose.Cells for .NET (Download Section).