I am writing a JSP page which provides a user with some form. I am wanting to give the user the ability to save the form as a MS Word document. I'm just wondering if this is even possible. If you know how or have any links, please let me know. Thanks.
Do you want the processing to be done on the server instead of the client? i.e. the form has a link or button that says something like "Download as a Word file"? If so, then you can look into the JACOB project or the OpenOffice APIs. It isn't too complex, but it does take some fiddling to get it right.
Alternatively, Word 2003 and later have the ability to read from and write to XML (I think it is going to be the default in Word 2005). It would be fairly easy to convert the page to XML and send it back as a .doc file. The drawback is that versions prior to 2003 would not be able to open the file.
“Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.” - Rich Cook
Joined: Feb 23, 2003
If you want to do it on server side, you can create a template file. Feed in data and transform to RTF format. The way it works is just like we manually did in local computer.
1. create a template file 2. Feed in data when user submit the form 3. Save the template file to another html file 4. Transform the html file to RTF document by some add-in tool(you can find some on above link I provide) 5. Redirect the browser to the new RTF document to let user download.