JDev11g Export Table To Excel
Posted by Steve Racanovic | Posted in JDev | Posted on 9:11 AM
0
JDev 11g offers a simple way to export an ADF table to excel in a couple simple steps.
1. Create af:panelCollection on the jspx page.
2. Drag a data control onto af:panelCollection and drop it as table.
3. Set af:table id to table.
4. Expand Panel Collection facets, and drop af:toolbar on toolbar facet.
5. Drop af:commandButton on af:toolbar. Set the text to "Export To Excel"
6. Drop af:exportCollectionActionListener on af:commandButton. And set the following:
ExportId: table
Type: excelHTML
Filename: Emp.xls
Title: Employees.
The exportId needs to bind to the af:table id. Which we set as 'table' in step 3
7. Run the jspx page and test the export button.
This is how the my final code looks like:
<panelCollection>
<facet name="menus"/>
<facet name="toolbar">
<toolbar>
<commandButton text="Export To Excel">
<exportCollectionActionListener exportedId="table" type="excelHTML"
filename="Emp.xls" title="Employees"/>
</commandButton>
</toolbar>
</facet>
<facet name="statusbar"/>
<table value="#{bindings.EmpView1.collectionModel}" var="row"
rows="#{bindings.EmpView1.rangeSize}"
emptyText="#{bindings.EmpView1.viewable ? 'No rows yet.' : 'Access Denied.'}"
fetchSize="#{bindings.EmpView1.rangeSize}" filterVisible="false"
id="table">
<column sortProperty="Empno" sortable="false"
headerText="#{bindings.EmpView1.hints.Empno.label}"
filterable="false">
<outputText value="#{row.Empno}">
<convertNumber groupingUsed="false"
pattern="#{bindings.EmpView1.hints.Empno.format}"/>
</outputText>
</column>
...
...
...
</table>
</panelCollection>
Comments (0)
Post a Comment