EvotecIT / OfficeIMO

Fast and easy to use cross-platform .NET library that creates or modifies Microsoft Word (DocX) and later also Excel (XLSX) files without installing any software. Library is based on Open XML SDK
MIT License
280 stars 50 forks source link

Extending available FieldCodes and allow setting parameters #75

Closed byteSamurai closed 1 year ago

byteSamurai commented 1 year ago

This PR closes #71

The main contribution is a fieldCodeParser, which interprets the field code strings into their components. There are a few open questions that have been added as comments in the code. Though this approach is not the final perfect one, it might be a good start for further extensions in that direction.

Also, I did almost no refactoring here to avoid blowing up this PR too much.

@PrzemyslawKlys WDYT?

byteSamurai commented 1 year ago

Side note: I could only run the tests successfully on macOs, once I limited the target frameworks to .net6.0 or higher. Also: The Test project required me to add this line, which I did not commit, to avoid conflicts with your build/setup:

<PackageReference Include="Microsoft.TestPlatform.ObjectModel" Version="17.4.0" Condition="$([MSBuild]::IsOsPlatform('OSX'))" />
PrzemyslawKlys commented 1 year ago

I guess if it's a condition, it would not impact my setup, but maybe better to do separate PR to adjust it to multiple OS development scenarios like you mentioned in the issue.

As for the PR itself, can you add maybe 1-2 different examples (not tests) showing how to use fields there are non-standard (aka showing what you added). From the code that I do understand everything seems ok, for the other I probably lack some knowledge to be able to fully comprehend it - but as long as everything works I'm happy ;)

I did some configuration for macOs/linux that limits amount of frameworks being tested but I am not sure whether this is limited to just AzureDevops or within VS it works too.

image

And those seems to work. I guess we can exclude all products that are EOL.

byteSamurai commented 1 year ago

I did some configuration for macOs/linux that limits amount of frameworks being tested but I am not sure whether this is limited to just AzureDevops or within VS it works too.

I know, from what I can tell: It works if I use the dotnet CLI, but not with the VSCode or VS - which was crucial, since I needed a debugger.

As for the PR itself, can you add maybe 1-2 different examples (not tests) showing how to use fields there are non-standard (aka showing what you added)

Provided.. It's not much, but it works :)