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

Free Support Forum - aspose.com

NullReferenceException on Excel file with linked SVG picture

@infotron,

Please try our latest version/fix: Aspose.Cells for .NET v20.4.5 (attached)

Your issue should be fixed in it.

Let us know your feedback.
Aspose.Cells20.4.5 For .Net2_AuthenticodeSigned.Zip (5.3 MB)
Aspose.Cells20.4.5 For .Net4.0.Zip (5.4 MB)

When testing this version 20.4.5, we’re getting an Aspose.Cells.CellsException ‘The file is corrupted.’ on LinkedSvgPicture.xlsx. The NullReferenceException is gone, but now another exception is thrown. Can you recheck?

@infotron,

I used the following sample line of code using your original file (you attached earlier) with Aspose.Cells for .NET v20.4.5, it works fine and I do not get your other exception “The file is corrupted.”:

var workbook = new Workbook(“LinkedSvgPicture.xlsx”);

Do you re-save the file? Kindly provide your code segment to reproduce the issue, we will check it soon.

Download the test project: AsposeTestProject.zip (234.8 KB)

This issue is indeed fixed for the AsposeTestProjectNetFramework. But the exception still occurs for the AsposeTestProjectNetCore. Thank you for investigating!

In addition, now that I can read this file with .NET Framwork, I noticed that the field SourceFullName for the picture in “LinkedSvgPicture.xlsx” is null. For other images (e.g. PNG) inserted via ‘Link to file’ or ‘Insert and link’, this field is filled with the source URL. Apparently, this is not working for SVG images. The source URL is present in the underlying XML, if you unzip “LinkedSvgPicture.xlsx” (see drawing1.xlm.rels).

Should I create a new topic or can you investigate this too?

And another question, the ImageType of the SVG image is ImageType.Png. Shouldn’t this be ImageType.Svg?

It looks like you are using Aspose.Cells for .NET v20.4.5 (.NET 4.0) fix in your .NET Core project. Well, you need to use Aspose.Cells for .NET Standard/.NET Core fix. We will check if we could provide you the .NET Core fix for your needs.

@infotron,
Please try our latest version/fix: Aspose.Cells for .NET v20.4.6 (attached)

Your issue should be fixed in it.

Let us know your feedback.

Aspose.Cells20.4.6 For .NetStandard20.Zip (5.3 MB)
Aspose.Cells20.4.6 For .Net2_AuthenticodeSigned.Zip (5.3 MB)
Aspose.Cells20.4.6 For .Net4.0.Zip (5.4 MB)

With the latest version (v20.4.6), the null reference exception is fixed. I’m able to load the file with the linked SVG picture in the AsposeTestProjectNetFramework, and also in AsposeTestProjectNetCore (after adding the System.Drawing.Common package manually from NuGet).

Thank you for investigating and providing a fix!

The two related issues are not solved. The SourceFullName and ImageType of this picture is still incorrect/incomplete.

See my two earlier replies:

NullReferenceException on Excel file with linked SVG picture (comment #8)
NullReferenceException on Excel file with linked SVG picture (comment #9)

Should I create a new topic?

@infotron,
We are glad to know that your earlier issue is resolved. We have noted your concerns and regarding comment#8 and #9. We will analyze it and share our feedback soon.

@infotron,
We have logged the other concerns as “CELLSNET-47362” in our database for investigations. Once, we will have some news for you, we will update you in this topic.

The issues you have found earlier (filed as CELLSNET-47319) have been fixed in Aspose.Cells for .NET v20.5. This message was posted using Bugs notification tool by Amjad_Sahi

@infotron,

This is to inform you that we have fixed your issue “CELLSNET-47362” now and hopefully you will be getting the fix in the next few days after we have performed QA and incorporated other enhancements and fixes.

@infotron,

Please try our latest version/fix: Aspose.Cells for .NET v20.5.1 (attached)

Your issues (“CELLSNET-47362” and “CELLSNET-47319”) should be fixed in it.

Let us know your feedback.
Aspose.Cells20.5.1 For .Net2_AuthenticodeSigned.Zip (5.3 MB)
Aspose.Cells20.5.1 For .Net4.0.Zip (5.4 MB)

Both issues are fixed in this v20.5.1. The properties SourceFullName and ImageType are now correct. Thank you!

Just one detail: I noticed that in v20.5.1 the Data property throws an ArgumentOutOfRange exception on this picture. See screenshot: LinkedSvgPicture_Data_Property.png (26.6 KB)

The method ToImage() works correctly, so it is possible to get the raw image data. Maybe you want to fix this exception?

@infotron,

After an initial test, we noticed that Picture.Data property throws an ArgumentOutOfRange exception. I used the following sample code:
e.g
Sample code:

var workbook = new Workbook("e:\\test2\\LinkedSvgPicture.xlsx");
            var picture = workbook.Worksheets[0].Pictures[0];
            //save the image:
                    byte[] data = picture.Data;//exception 

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

Once we have an update on it, we will let you know.

@infotron,

This is to inform you that we have fixed your issue “CELLSNET-47381” now and hopefully you will be getting the fix in the next few days after we have performed QA and incorporated other enhancements and fixes.

@infotron,

Please try our latest version/fix: Aspose.Cells for .NET v20.5.2 (attached)

Your issue should be fixed in it.

Let us know your feedback.
Aspose.Cells20.5.2 For .Net2_AuthenticodeSigned.Zip (5.4 MB)
Aspose.Cells20.5.2 For .Net4.0.Zip (5.4 MB)
Aspose.Cells20.5.2 For .NetStandard20.Zip (5.3 MB)