Updating autofields automatially in Microsoft Word
I am converting html to MS word file through XSLT 1.0 with some autofields(date,time,filename etc..).But when i open the document(docx,doc) in word, i couldn't update those autofields automatically, currently i am doing manually by right click开发者_如何转开发 and select updatefields.I created a macro for updating autofields in MS word. How to run those macros through xslt to update the fields automatically whenever i open the document or any other solution(prefer java and xslt)?..
Please help me..Thanks in advance
There is a library called Apache POI to manipulate Office documents from your java code, though I am not sure if it'll help on your specific problem.
By the way, I feel java might not be the best environment for automation scripts for Word documents; don't they have a Visual Basic (or something similar) editor for writing custom scripts?
Sorry I couldn't be of more help.
You may be able to avoid the whole macro thing by setting the field to dirty:
<w:fldChar w:type="start" w:dirty="true"/>
If you go the macro route, you need to inject the macro into your docx and set it to execute on open.
How you do this is dependent on your chosen toolset (eg plain XSLT, or docx4j, POI etc).
Are you creating a docx, Flat OPC XML, RTF, or just letting Word open your HTML file?
精彩评论