开发者

How can we export jsp to doc file?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜