Page 1 of 1

Problem setting DocVariables

PostPosted: Tue Jun 21, 2011 3:39 am
by Grendel
Hello there,

i'm having problems setting docvariables.
I can set them via the CTDocVars, but when I save my document and open it in Word, I still have to refresh the fields and activate the formulas. Is there any way of doing this automatically without opening the docx in Word? Am I doing anything wrong here?

Any help is greatly appreciated.

Re: Problem setting DocVariables

PostPosted: Tue Jun 21, 2011 9:52 am
by jason
Grendel wrote:Hello there,
I can set them via the CTDocVars, but when I save my document and open it in Word, I still have to refresh the fields and activate the formulas. Is there any way of doing this automatically without opening the docx in Word? Am I doing anything wrong here?


I think you'd need to traverse the document in docx4j, programmatically updating the fields. docx4j can help you to programmatically traverse the docx, and to manipulate the fields, but doesn't contain anything special dedicated to your requirement. (Compare the OpenDoPE approach, for which it does do the equivalent)

Re: Problem setting DocVariables

PostPosted: Tue Jun 21, 2011 7:01 pm
by Grendel
Thanks jason,

I'll try that. I'm not sure how much work that will be, I got a large document with lots of "if documentvariable = xxx".

Re: Problem setting DocVariables

PostPosted: Wed Aug 12, 2020 6:25 pm
by overlord206
jason wrote:
Grendel wrote:Hello there,
I can set them via the CTDocVars, but when I save my document and open it in Word, I still have to refresh the fields and activate the formulas. Is there any way of doing this automatically without opening the docx in Word? Am I doing anything wrong here?


I think you'd need to traverse the document in docx4j, programmatically updating the fields. docx4j can help you to programmatically traverse the docx, and to manipulate the fields, but doesn't contain anything special dedicated to your requirement. (Compare the OpenDoPE approach, for which it does do the equivalent)


Has anything changed since this question has been asked? I'm having the same problem.