Content control toolkit creates extra custom xml p

2019-09-17 00:15发布

问题:

I am creating a docx with 2 rich text controls and 1 picture control. I open content control toolkit, create 1 custom xml part, type in the xml and bind xml tags to the content controls. I save the mapping and close it. When I reopen the docx, I see 3 custom xml parts created. All 3 with all the content controls. I am surprised why it would do that. As a result, when I apply the bindings using docx4j API, the data gets updated in the last custom xml part. Guess the output docx only shows the first custom xml part and hence I dont see any bound values. When I unzipped the docx and looked at the contents, I see that the last cutom xml part has been updated with the values, I set using the docx4j code. Am I doing anything different that makes content control toolkit create the extra custom xml parts? Please let me know.

回答1:

If you look at the w:dataBinding elements, do they each have the same @w:storeItemID values?

Given your description, you'd expect a different value for each content control. If that's the case, docx4j should respect that. That is, it ought to use whatever is in the three custom XML parts. (The standard code for first injecting the XML will only inject it into one part though)

As a general comment, most docx4j users (me included) would use an OpenDoPE AddIn, not the content control toolkit, so I can't comment on its behaviour.



标签: docx4j