JSP响应内容类型为Excel [英] JSP response content type Excel
本文介绍了JSP响应内容类型为Excel的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我设置响应内容类型是excel。在excel表中,它是dsiplaying 1-Jan而不是1-1。
这里是代码片段
when i set response content type is excel. In excel sheet it is dsiplaying 1-Jan instead-of 1-1. here is code snippet
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%
response.setContentType("application/vnd.ms-excel");
%>
<table><tr><td>1-1</td></tr></table>
追加单引号'将起作用。有没有其他解决方案设置单元格格式或正确的文本?
Appending single quote "'" will work. is there any other solution to set cell format or correct text?
推荐答案
您可以使用Apache POI项目返回Excel文件到输出流,这将允许您进行适当的数据/单元格格式。
You could use the Apache POI project to return an Excel file to the output stream, which will allow you to do proper data/cell formatting.
是否适合您?
这篇关于JSP响应内容类型为Excel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文