This repository has been archived by the owner on Mar 9, 2020. It is now read-only.
Fix WMF and EMF being converted to PNG In ExcelPicture #490
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
-[] Write a detailed description of your what you have implemented or changed.
Currently,
ExcelPicture
usesImageConverter
to convert_image
to bytes. The converter eventually will callImage.Save()
as part of the process. This is a problem with vector-based images formats EMF and WMF. Since there is noImageFormat
loaded from the GDI for those formatsImage.Save()
will fall back to using the PNG.This PR proposes to change from
ImageConverter
to using the existing image stream and re-traversing in the two associated constructors. This will properly store the vector images. This is compatible with both .NET Legacy and .NET Core - no need for compileIF
.-[] Attach unit tests in the testproject to test implemented functionallity.
Seven (7) unit tests were added to the
DrawingTests
class for the image formats: png, bmp, jpg, gif, tif, emf, and wmf. They create aPackage
in memory and then extract the image using aZipArchive
to confirm theRawFormat
. The EMF and WMF tests were red in the prior version and are now green.-[] Make sure no tests fail in the test project.
All tests in
DrawingTests
pass. All but one test in theEEPlusTest
library pass. The one test that fails has to do with Issue 333 which failed prior.-[] Verify that you only check in the files intended for the pull request.
Several new test images were added to the project in order to test all of the above formats. Otherwise, it is only the
ExcelPicture.cs
that was changed.-[] Do not change dotnet version, include new dependencies unless you explicitly talked to someone in the project about doing so.
The only project-level change was adding was to
EPPlusTests
: