Page 1 of 1

Need to update Autofields

PostPosted: Mon Feb 14, 2011 2:23 am
by AnbuChezhian
Hi ,

I am using docx4j to convert html to docx . Is it possible to update autofields ( date,TOC,sequence no.) automatically ?? Now i need to update fields by right click on field and need to update manually .

Regards,
Anbu Chezhian.

Re: Need to update Autofields

PostPosted: Wed Feb 16, 2011 6:46 pm
by jason
In principle, docx4j could do that for you for many fields.

However, there is no code to do so at present.

You'd need code to parse the field codes.

Page number is an example of a challenging one, since to get page numbers right, we'd need Word's page layout model.

Maybe I should add a class which finds the fields for updating, then users such as yourself could contribute implementations for particular fields of interest?

Re: Need to update Autofields

PostPosted: Tue Mar 08, 2011 2:34 am
by Richard
Hi Jason,

have you already programed something for this field update requirement?

I think it is a good idea to add such a feature, because if you generate a pdf it would be fantastic to see up-to-date content.
I would try to implement a method, which updates formulas in table, because it is a feature I need.

Richard

Re: Need to update Autofields

PostPosted: Tue Mar 08, 2011 7:38 am
by jason
Hi Richard

Please see also this thread viewtopic.php?f=6&t=629

I haven't written any code.

For the benefit of anyone else who stumbles across this though, there is a little bit of field related code in docx2fo.xslt (ie supporting PDF output).

cheers .. Jason

Re: Need to update Autofields

PostPosted: Tue Feb 05, 2013 9:47 pm
by gnaik
Hi Jason/Richard,

I have a requirement to pro-grammatically update the field codes. Is it possible to do this using docx4j APIs? Does anyone have the code snippet to do this? Any help in this regard would be really great.

Thanks,
Gopal

Re: Need to update Autofields

PostPosted: Wed Feb 06, 2013 1:57 pm
by jason
The code in the package https://github.com/plutext/docx4j/tree/ ... del/fields (and supporting samples) is as far as we go at the moment. Please study that.