sergey-tihon / Clippit

Fresh PowerTools for OpenXml
https://sergey-tihon.github.io/Clippit/
MIT License
50 stars 19 forks source link

Document Assembler - Small Code Reorganisation #83

Closed MalcolmJohnston closed 2 weeks ago

MalcolmJohnston commented 2 weeks ago

Hello Sergey,

Thanks for providing Clippit, though I am not using it yet, it's great that those of us relying on OpenXmlPowerTools have a maintained repository again!

I have some improvements that I want to make to DocumentAssembler these are:

  1. Ability to create component templates for reusable parts of a template
  2. Ability to use basic HTML formatting in DocumentAssembler (bold, italic, underline, hyperlink)

Before I get to these in my existing fork I have tried to move as much code as possible out of DocumentAssembler.cs, in the spirit of keeping PRs small I have done something similar in this PR. The changes include:

  1. Moving Definition classes PA and PASchemaset out to Assembler namespace
  2. Moving TemplateError class out to Assembler namespace
  3. Moving Error Message methods to the ErrorHandler class
  4. Creating Extensions methods for the XPath wrappers methods

This is by no means a large scale refactor, but I wanted to start somewhere as the original Open XML Power Tools code is a bit hairy.

Once this PR is merged then I will again do separate PRs for the above functionality.

All tests are passing (other than the one test that has been explicitly marked to skip).

Hope this works for you?

sergey-tihon commented 2 weeks ago

Hi, first of all, thank you for this PR.

Yes, I like your plan and love small, focused, easy-for-review PRs.

Just one note. This project currently formats that code using Csharpier. Please install the CSharper add-in for your preferred IDE or run dotnet csharper . before the commit.