antonmihaylov / OpenXmlTemplates

Word .docx templating system that is designer (no scripting tags) and server-friendly (no word installation required)
GNU Lesser General Public License v3.0
89 stars 25 forks source link

What is the advantage of this compared to Open-Xml-PowerTools? #23

Open rklec opened 2 years ago

rklec commented 2 years ago

As far as I see this here supports a special syntax for template parsing and has some features to add and remove text/document content parts.

Now They also support a special syntax, see the example they provide here: grafik

From the first look, their syntax (supporting loops etc.) even looks more elaborate. They just seem to use XML for inputting data, while you use JSON or a dictionary.

So what is the advantage of your library here?

Maybe you want to document that in a Readme.

dgwaldo commented 2 years ago

:) Maybe Open-Xml-PowerTools should document how to use it for templating in their ReadMe. We decided to use this project over power tools. For the most part we've been very happy with that choice. Templating format matters for your sanity. <# <Content Select="" ... looks like its straight out of web forms. This library provides a better templating syntax. We don't use XML data, so we'd have to convert our JSON to XML. This library provides a pluggable architecture to take data from whatever format you need to adapt from. And it supports the common ones out of the box. Templating can get complex, our templates are. This library is a higher level abstraction, easier to use that OpenXML Power Tools.

antonmihaylov commented 2 years ago

What @dgwaldo wrote was pretty much the intended purpose that made me start this project.

There are other solutions, like Open-Xml-PowerTools, yes. But if I hand a similar-looking document over to a non-technical person they will most likely get scared of it and will require technical assistance for any type of changes on it. So the developer will be responsible for changing the templates.

While a template for OpenXmlTemplates looks at least a bit better, all the variables are inside content controls, not within some specific markup tags. And arguably the syntax is easier to learn (<# <Conditional Select=x Match=y/> ... </EndConditional/> vs conditionalRemove_X_eq_Y>

Can you elaborate on

their syntax (supporting loops etc.) even looks more elaborate.

I might be missing something, but I don't see anything not supported in OpenXmlTemplates in that screenshot. Repeating sections are supported

rklec commented 2 years ago

Okay thanks for explaining all that.

I might be missing something, but I don't see anything not supported in OpenXmlTemplates in that screenshot. Repeating sections are supported

Yeah, I don't know, I just had a quick look and of course it's even better when your library can do the same. 🙂