使用displaytag+tiles导出excel的问题 [英] problem with using displaytag + tiles to export excel
问题描述
显示标签 1.2Spring + MVC 2.5.6瓷砖 2.0.7
DisplayTag 1.2 Spring + MVC 2.5.6 Tiles 2.0.7
我已经查看了该站点上围绕同一主题区域的其他一些项目,但似乎没有人回答如何将显示标签生成的表格导出到 excel 的问题.我可以导出/保存 xml 和 csv,但不能导出/保存 excel.需要其他罐子吗?
I have taken a look at some other items on this site around the same subject area but none seem to answer the question of how to export a table generated by display tag into excel. I am able to export/save xml and csv but not excel. Other jars that are needed?
基本设置:
web.xml
<!-- display tag -->
<filter>
<filter-name>ResponseOverrideFilter</filter-name>
<filter-class>org.displaytag.filter.ResponseOverrideFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>ResponseOverrideFilter</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>
displaytag.properties
displaytag.properties
#export
export.types=csv excel xml rtf pdf
export.excel=true
export.xml=true
export.csv=true
export.rtf=false
export.pdf=false
export.excel.class=org.displaytag.export.excel.DefaultHssfExportView
export.pdf.class=org.displaytag.export.DefaultPdfExportView
export.rtf.class=org.displaytag.export.DefaultRtfExportView
export.excel.include_header=true
export.cvs.include_header=true
html
<display:table export="true" id="row" class="gridTable" name="shippingCommands" defaultsort="1" sort="list" requestURI="shipHome.html" defaultorder="ascending" pagesize="100">
<display:column title="Customer Name" sortable="true" sortName="customerName">
${row.customerName }
<c:if test="${null != row.customerContactName}">
<br />
<br />${row.customerContactName}
</c:if>
</display:column>
<display:column property="storeNumber" title="Store #" sortable="true" sortName="storeNumber" comparator="vsg.ecotrak.common.comparator.AlphanumComparator"/>
<display:column property="storeAddress" title="Store Address"/>
<display:column property="programName" title="Program" sortable="true" sortName="programName"/>
<display:column property="boxType" title="Box Type" sortable="true" sortName="boxType"/>
<display:column class="table-10" property="qtyToShip" title="# of Boxes" sortable="true" sortName="qtyToShip"/>
<display:column property="orderType" title="Order Type" sortable="true" sortName="orderType"/>
<display:column class="actions" media="html">
<a class="action-fulfill" href="shipSummary.html?action=summary&orderId=${row.orderId}">Fulfill</a>
<a class="action-delete" href="javascript:confirmDelete(${row.orderId})" title="Delete Order" >Delete Order</a>
</display:column>
<display:setProperty name="export.rtf.filename" value="boxestoship.rtf"/>
<display:setProperty name="export.csv.filename" value="boxestoship.csv"/>
<display:setProperty name="export.excel.filename" value="boxestoship.xls"/>
<display:setProperty name="export.xml.filename" value="boxestoship.xml"/>
</display:table>
<小时>
事实证明excel适用于poi-3.2-FINAL.jar而不是poi-3.7.不知道为什么,但我就是这样做的.
It turns out that excel works with poi-3.2-FINAL.jar and not poi-3.7. Not sure why but that is what I did to get it to work.
推荐答案
确保您的 WEB-INF/lib
文件夹中有 poi-3.2-FINAL.jar
.
Make sure you have poi-3.2-FINAL.jar
in your WEB-INF/lib
folder.
您的项目中可以有多个 poi jar,但至少这个 poi-3.2-FINAL.jar
是强制性并且必须 拥有.
You can have more than one poi jars in your project but at least this one poi-3.2-FINAL.jar
is compulsory and must to have.
如果您想以其他格式导出,例如Excel - 2007 .xlsx 格式 如图所示您需要
If you want to export in other formats e.g. Excel - 2007 .xlsx format As shown here you need to have
poi-3.2-FINAL.jar
poi-3.2-FINAL.jar
poi-3.9.jar
poi-3.9.jar
poi-ooxml-3.9.jar
poi-ooxml-3.9.jar
poi-ooxml-schemas-3.9.jar
poi-ooxml-schemas-3.9.jar
xmlbeans-2.6.0.jar
xmlbeans-2.6.0.jar
stax-api-1.0.1.jar
stax-api-1.0.1.jar
和其他依赖 jars.
and other dependencies jars.
这篇关于使用displaytag+tiles导出excel的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!