Open-XML-SDK addImagePart extension method to support GetImagePartType feature
I was unsure of where to add the functionality described in #1081
I ultimately decided that it might be best to create an ImagePartExtensions
class that:
- Defines a
GetImagePartType
method given an associated file extension string. - Overloads
AddImagePart
with a version that takes the file extension string and adds theImagePart
using the native method, but retrieving theImagePartType
via the above method.
If there is a better place / approach for this feature, please let me know so that I have a better grasp on where to accomplish similar features in the future should they arise. Thanks!
6 Answer:
I believe you should still be getting a warning about public APIs. If not, let's see if the build passes here
You should get a warning in VS that it's not part of the public API and be offered to add it to the list
Sorry, I was using VS Code and didn't have any way of adding to the public API. Should be good to go now with the exception that it is giving end of life warnings for .NET Core 2.1. I merged with the latest from main here, and I'm still getting EOL warnings.
those warnings are fine. Thanks for the heads up about VS code. Do you have the csharp extension added in there?
LGTM! Thanks
No worries, thanks for the help!
those warnings are fine. Thanks for the heads up about VS code. Do you have the csharp extension added in there?
I sure do. It didn't underline the class name or the extension method for me to pull up suggested actions the way it did in VS.
I primarily work from a monorepo where I have a single Web API, an Angular library, and multiple Angular apps, so VS Code works a lot better for me on the day to day. Example repo if interested.