We noticed that Aspose.Cells is unable to read files containing linked SVG pictures. To reproduce:
- Start with a empty workbook.
- Go to Insert » Pictures and enter the following URL:
https://upload.wikimedia.org/wikipedia/commons/7/7f/Microsoft_Office_Excel_%282018%E2%80%93present%29.svg
- Next to the ‘Insert’ button, click on ‘Link to File’ instead of ‘Insert’.
- Save the workbook.
The Excel file can be downloaded here: LinkedSvgPicture.xlsx.zip (76.2 KB)
Loading this file with Aspose 20.4.0 gives a NullReferenceException:
var workbook = new Workbook("LinkedSvgPicture.xlsx");
@infotron,
We were able to observe the issue but we need to look into it more. We have logged the issue in our database for investigation and for a fix. Once, we will have some news for you, we will update you in this topic.
This issue has been logged as
CELLSNET-47319 – NullReferenceException on Excel file with linked SVG picture
@infotron,
This is to inform you that we have fixed your issue (logged earlier as “CELLSNET-47319”) now. We will soon provide you the fixed version after performing QA and incorporating other enhancements and fixes.
1 Like
@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 - #8 by perfectxl (comment #8)
NullReferenceException on Excel file with linked SVG picture - #9 by perfectxl (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?