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:

  1. Defines a GetImagePartType method given an associated file extension string.
  2. Overloads AddImagePart with a version that takes the file extension string and adds the ImagePart using the native method, but retrieving the ImagePartType 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!

Asked Jan 09 '22 09:01
avatar JaimeStill
JaimeStill

6 Answer:

CLA assistant check
All CLA requirements met.

1
Answered Nov 29 '21 at 23:50
avatar  of microsoft-cla[bot]
microsoft-cla[bot]

I believe you should still be getting a warning about public APIs. If not, let's see if the build passes here

1
Answered Dec 01 '21 at 23:28
avatar  of twsouthwick
twsouthwick

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

1
Answered Dec 02 '21 at 17:51
avatar  of twsouthwick
twsouthwick

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.

1
Answered Dec 03 '21 at 19:43
avatar  of JaimeStill
JaimeStill

those warnings are fine. Thanks for the heads up about VS code. Do you have the csharp extension added in there?

1
Answered Dec 03 '21 at 23:25
avatar  of twsouthwick
twsouthwick

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.

1
Answered Dec 03 '21 at 23:51
avatar  of JaimeStill
JaimeStill

Read next