You left out the important part of the code, namely the code which writes what you say is a Word document. My guess is that you aren't writing a Word document at all. That would be very hard to do in a JSP, given that a JSP is for producing text formats and Word documents aren't text formats.
Joined: May 31, 2010
Thanks for your feedback! Ulf Dittmer can you explain to me how I would go about exporting in RTF? Are maybe direct me to a site...
Do you thinkg if I export in PDF it would keep the format?
He we can't get what we need by extracting in Word maybe we could extract in PDF and from there save as word. PDF 8 does keep the formatting from PDF to Word. So basically I would prefer Word but I was wondering if PDF keeps the formating.
Of course, the entire purpose of PDF is to format documents to be read by humans. So of course it "keeps the formatting".
If you can produce a PDF, then (according to you) your problem is solved. However since PDF isn't a text format, don't use a JSP to output it. Use a servlet instead.
Your original mistake was to assume that you could simply assert that your document was MS Word and you expected your HTML to be converted to Word. That isn't how it works. Likewise you can't just assert that your document is a PDF document, you actually have to produce data in the PDF format.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: Jsp page export to Word Document without losing format