Hi All,
I have a JSP file that is going to flush all data from database into a ms-word document by setting the content-type
keyword. Now the problem is I need to add header and footer to the same document for which after many searches couldn't find a direct way from JSP without using APIs like POI. So I went ahead and created a macro for it which works fine locally. But how do I add this to a dynamically generated word file which I'm not sure how far possible. But is there way for it or any other suggestions would also be welcomed.
Thank You...
views:
234answers:
2
+1
A:
I had a similar problem with POI and Excel.
The solution is to manually create a template .doc file, with the macro present. Then in your code, load that document, amend it with your data, and save it. The macro will be preserved from the template document.
Brian Agnew
2009-10-14 07:45:15
Thanks for your tip.. But U mean to use POI to do this?? Currently as I said it is a JSP page with 'contenttype set as ms word'.. Is it possible to open and append data to the existing template doc without POI stuff?? If so I'm not sure how (Though I have my templates ready :)).. Do help me on this..! Thanks
Dawner
2009-10-14 08:43:50
I think the best way is to use POI to do anything relating to Microsoft formats.
Brian Agnew
2009-10-14 22:36:32
ok then.. But the work time involving to resolve this thing isn't so satisfactory.. Anyway thanks man..!! I will have a look into this..
Dawner
2009-10-15 04:59:32
A:
I'd use POI or docx4j to create a docx file on the server, and add the header/footer as part of that process.
plutext
2009-10-18 23:00:03