0

I want to be able to bind content control fields to each others' values. Basically if you change a field at the top, all others in the document also update to that. I'm replacing hundreds of individual variables, each with 100 duplicates. There is a better way than the 'Find and Replace Tool'.

Here is a sample document directly from Microsoft's site that shows exactly what I would like to be able to do:

https://omextemplates.content.office.net/support/templates/en-us/tf03444179.dotx

When the '' value is changed, all others in the document update.

I've already looked at plenty of solutions like: c# word interop find and replace everything

But they do not dynamically respond during run-time. In other words you have to go in and change which string you want to replace for each value.

Been looking for a while now, thanks in advance if anyone else can figure this out.

jchmns
  • 1
  • What do you mean by "you have to go in and change which string you want to replace for each value"? I assume that is when the program runs, it will open Microsoft Word and popup "Find and Replace" like you perform it in Microsoft Word without the program? And which type of document your program will process, doc or docx? – Red Wei Oct 19 '17 at 02:58
  • @RedWei I dont care whether it is doc or docx, I can do whichever. I do not want to have to use the built in find and replace feature- there is a lot of copy and pasting for each value I want to replace. If you go and look at the microsoft word document I attached, you can see how the content controls all update when you edit one. – jchmns Oct 19 '17 at 18:44
  • It IS important whether you want to process doc or docx. If you go for doc you must stick with Interop, if you go for docx and DOCX ONLY you have to process OOXML which is easier and don't require Microsoft Word. – Red Wei Oct 20 '17 at 00:22
  • When you work with Interop, your must close all the WINWORD.exe processes in the Task Manager because it will open a hidden Microsoft Word process whenever you open a document by Interop. They DO dynamically respond during run-time but you can't see it because it is reflected inside the process WINWORD.exe which doesn't have an UI. You must save the document to see that change. When you have changed all the required content, you call document.Save() or document.SaveAs2() method to save the word file and see the change – Red Wei Oct 20 '17 at 00:44

0 Answers0