How can I export a jsp page to word document without losing it's formating? Here is what I have it works fine but dosen't keep the formating like bold, italic ect..
<%@ page language="java" contentType="application/msword"
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ page import="java.util.*" %>
<%@ taglib uri="http://java.fckeditor.net" prefix="FCK" %>
Also when the word document opens and I save as it seems that it was not a .doc but .txt file.
Either use a library like Apache POI to generate an actual Word document, or maybe generate an RTF document (which -being plain text with markup- is much easier than an actual DOC).
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.