1

I need to dynamically generate contracts, and for that our HR depart already has some specific templates which only need a few changes (like names, address, phone number, etc).

For that reason, I'm looking for a library that will help me with the following:

  1. Read a word file (used as a template)

  2. Identify specially marked pieces of text, and replace them.

Do you know of any library(preferably free) that will help achieve that?

P.S. The .Net Framework I'm using is 4.6.1

eddy
  • 4,373
  • 16
  • 60
  • 94
  • Requesting libraries, etc. is off-topic on Stack Overflow... There are lots of examples of this kind of code "out there". As long as the template is set up correctly it's not really a big problem, nor does it require lots of code. – Cindy Meister Jan 21 '19 at 14:53
  • Yes, but all of them either use Interop or OpenXML and I want to avoid using them. Specially the former. – eddy Jan 21 '19 at 14:59
  • I didn't know it was off-topic to ask for a library. And if you think I should close/delete this question, you could have said so. No need to upvote the question :( – eddy Jan 21 '19 at 15:01
  • What do you think a library would do differently? It certainly will also use the "Interop" or Open XML. – Cindy Meister Jan 21 '19 at 15:04
  • Things that are off-topic can be found listed at https://stackoverflow.com/help/on-topic. The question can be deleted, but first you might want to clarify why you think you need a library. – Cindy Meister Jan 21 '19 at 15:05
  • For example for Excel we have ClosedXML which will let us specify variables (using curly brackets) to later easily replace them. – eddy Jan 21 '19 at 15:09
  • That certainly also uses the Open XML file format. So what you mean is something that (from your POV) makes your life simpler? (I'm so steeped in Word I find it really easy to just write the code - different perspective...) Yes, I'd say you can delete this question and ask it somewhere else that doesn't have the same restrictions as SO. – Cindy Meister Jan 21 '19 at 15:19

1 Answers1

1

I'd use the WordprocessingDocument Class.

Paulo Morgado
  • 14,111
  • 3
  • 31
  • 59