ofbiz内置的导出excel功能

controller配置

<request-map uri="ProductInventoryInAndOutDetail.xls">
    <security https="true" auth="true"/>
    <response name="success" type="view" value="ProductInventoryInAndOutDetailExport"/>
</request-map>
<view-map name="ProductInventoryInAndOutDetailExport" type="screenxls"
          page="component://product/widget/query/QueryScreens.xml#ProductInventoryInAndOutDetailExport"
          content-type="application/vnd.ms-excel"/>
这里URI以.xls结尾导出的文件才会带有xls的文件格式。type="screenxls"和content-type="application/vnd.ms-excel"是固定的格式;

Screen配置

<screen name="ProductInventoryInAndOutDetailExport">
        <section>
            <actions>
              .....
            </actions>
            <widgets>
                <screenlet>            
                    ....
                </screenlet>
            </widgets>
        </section>

    </screen>

注意:如果<widgets>里面引用了<decorator-screen>,那么导出的excel也会把这个装饰器的内容打印出来。表格可以引用form或者ftl文件。这里只介绍form的

form配置

<form name="ProductInventoryInAndOutDetailListForExport" type="list" target="" title=""
      list-name="inventoryItemOutAndInDetail"
      odd-row-style="k-alt" header-row-style="header-row-2" default-table-style="basic-table hover-bar"
      paginate-target="${productInventoryInAndOutDetail}" override-list-size="${overrideListSize}">
    <field name="num" title="序号"><display/></field>
    <field name="facilityId" title="场所"  >
        <display-entity entity-name="Facility" key-field-name="facilityId"
                        description="${facilityName}[${facilityId}]"/>
    </field>
    <field name="productId"  >
        <display description="'${productId}"/>
    </field>
</form>
list-name="需要展示的list"  paginate-target="查询的url" override-list-size="list的size"
值得注意的是当field字段有use-when时,导出可能会非常慢
 

 


  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值