Opening an XLSX file in .NET

Hello,


I am receiving the following error trying to open a workbook:

An unhandled exception of type ‘System.NullReferenceException’ occurred in Aspose.Cells.dll

Additional information: Object reference not set to an instance of an object.


This is my C# code to open the file:

string filePath = @“C:\temp\test.xlsx”;
Aspose.Cells.Workbook workbook = new Aspose.Cells.Workbook(filePath);

The workbook I’m trying to open is attached, and was created using the Open XML Format SDK 2.5

Is there any way you could take a look and let me know what I might be doing wrong?

Thank you!


Hi,

Thanks for your posting and using Aspose.Cells.

We were able to observe this exception using the latest version: Aspose.Cells for .NET v8.7.0.1
.The code throws null reference exception on opening your source excel file.

We have logged this issue in our database for investigation. We will look into it and fix this issue. Once the issue is resolved or we have some other update for you, we will let you know asap.

This issue has been logged as

  • CELLSNET-44212 - NullReference exception on opening the source excel file

C#
string filePath = @“F:\Shak-Data-RW\Downloads\test.xlsx”;

Workbook workbook = new Workbook(filePath);

Exception:
System.NullReferenceException was unhandled
Message=“Object reference not set to an instance of an object.”
Source=“Aspose.Cells”
StackTrace:
at ”.‰.˜(€ )
at ”.‰.˜(€ )
at ”.‰.˜(€ )
at ”.‰.Read(€ )
at ”.‡.—( , String )
at ”.‡.‰( , String )
at ”.‡.ƒ()
at ”.‡.Read()
at ”.†.(Workbook , LoadOptions )
at Aspose.Cells.Workbook.Ÿ(Stream , LoadOptions , Boolean )
at Aspose.Cells.Workbook.Ÿ(String , LoadOptions )
at Aspose.Cells.Workbook…ctor(String file)
at AsposeCells.Program.f1() in F:\Shak-Data-RW\Aspose\Libs\Projects\AsposeCells\Program.cs:line 47
at AsposeCells.Program.Main(String[] args) in F:\Shak-Data-RW\Aspose\Libs\Projects\AsposeCells\Program.cs:line 27
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:

Hi,


Which tool did you use to create this strange file?

Thanks,


Hi,


This is to update you that we have fixed your issue in the meantime. We will perform QA and include other enhancements and fixes before publishing the fix (in the forums) for the users.

Once the fix is available for public use, we will let you know here with a download link.

Thank you.


Hi Amjad,


Thank you, I’m glad to hear you have found and corrected the issue!

Here is the background on the file. It was originally created in Excel 2010 as an empty workbook with a blank Sheet1.

I’m using a C# console app with the Open XML Format SDK 2.5 to manipulate the file to add a new sheet, and then populate the headers/rows/etc.

I have scenarios where I’m building Excel spreadsheets with 200,000 or more rows of data which is why I went the Open XML direction to build my Excel file.

I haven’t tested it, but how does the Aspose Cells component handle building very large Excel files?

Thanks again,

–Eric

Hi Eric,

Thanks for sharing the details related to this issue and using Aspose.Cells.

We have logged your comment in our database for product team notice. Also we have closed this issue as Resolved. Let us know if you encounter any other issue, we will be glad to look into it and help you further.

Please note, fix will be available in next few days as mentioned earlier.

Aspose.Cells creates excel files from scratch and build its own Data Model (internal structure). It does not use any third party tool and only depends on .NET Framework APIs. You can create large excel files just like normal excel files, there is nothing different in their creations as far as code is concerned.

However, you may like to optimize memory while working with large excel files as per this article.

( Optimizing Memory Usage while Working with Big Files having Large Datasets|Documentation )

Hi,

Thanks for your using Aspose.Cells.

Please download and try the latest fix: Aspose.Cells for .NET (Download Section) and let us know your feedback.

Hi Shakeel,


I just tested and it works perfectly! Thank you very much for the quick turn around on this issue!

Can you tell me when you think this update will be published to NuGet?

Thanks again,

–Eric

Hi,


Good to know that your issue is sorted out by the latest fix.
Well, the fix v8.7.0.2 is an interim release but it will work fine on Production server, so you may use it for production use without any issue. Generally, we publish only official releases to Nuget repository. We are scheduled to release our next official version, i.e., Aspose.Cells for .NET v8.7.1 in the third or fourth week of February 2016. Once the released is published on Aspose site (Downloads module), we then publish it on NuGet rep. as well. So, you have to wait a bit if you need official release of the product to pick your desired Aspose.Cells assembly for the underlying .NET framework version(s) in the packages. Furthermore, our next official release v8.7.1 would include the functionality of all the previous fixes including this one too.

Thank you.

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


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