0
votes

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

2
You know a question falls into the "xslt" tag when it provides a source XML document, a wanted result and a descriptions of the required properties of the transformation.Dimitre Novatchev

2 Answers

0
votes

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.

0
votes

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?