OpenXML: Create Reusable Bound Content Controls

I need to attach specific XML to a text document so that the elements appear in the right places. I can do this with the OpenXML SDK.

The fact is that I also want to be able to define content controls that are already limited in some template, so that other people can create a real document template to which xml will be attached. Well, of course, people will not know what I mean, so I will explain further.

There can be many different document templates that will use the same XML data and thus the same content controls. It is for someone else to create a document.

Scenario: Some dude who is not a programmer needs to create a new form for ordinary information due to some changes (new layout or check). This has nothing to do with the XML information that remains the same.

The best solution for “some dude” would be to create a document in Word and drag and drop content controls into place (or some similar solution). Then, when XML is added to the document, there is no problem because the content controls are pre-bound.

Now here are a few points:

1) Is it possible to pre-set content bindings? If there is no XML in the path, will it not remain empty without problems?

2) Will binding Content Controls to CustomXML, like this, still work in future versions of Word due to an i4i lawsuit?

3) Is an even better optimal solution possible?

.

EDIT:

. , - xpath. .

, , , , .

X . , , CustomXML Docx. , XML- CC, XML .

+3
2
+2

. i4i, tag ( - 64 ).

+1

Source: https://habr.com/ru/post/1758383/


All Articles