开发者

How can we export jsp to doc file?

开发者 https://www.devze.com 2023-03-04 16:22 出处:网络
How can we export jsp to doc file using conte开发者_JS百科nt type?You can set the content type of a JSP via setContentType:

How can we export jsp to doc file using conte开发者_JS百科nt type?


You can set the content type of a JSP via setContentType:

response.setContentType("application/msword");

You'll want to be sure not to output anything from the JSP other than the data making up the Word document. And you'll want to check that MIME type; this is my source for the above, which is for one variant of Word files, but I think there's a more canonical MIME type I'm not finding (using "vnd"). And the type for .docx files is different, Microsoft says here that it's (deep breath) application/vnd.openxmlformats-officedocument.wordprocessingml.document.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号