Excel for Seam preview
nickarls May 21, 2008 9:00 AMHi,
Daniel Roth and myself have been tinkering with Excel for Seam in the same manner PDF docs can be created with iText.
If you'd like to check it out, download the jboss-seam-excel.jar here, grab JExcelAPI 2.6.6 here and you should be all set!
Documention is under construction but you can grab the docbook-draft from the source in the tracking JIRA
Feedback and bugs can be reported to this thread or in the JIRA. Please remember we are just entering testing so the warranty is If it breaks, you get to keep the pieces
;-)
simple use case:
<e:workbook xmlns:e="http://jboss.com/products/seam/excel"> <e:worksheet> <e:cell value="Hello World"/> </e:worksheet> </e:workbook>
normal use case
<e:workbook xmlns:e="http://jboss.com/products/seam/excel" xmlns:f="http://java.sun.com/jsf/core"> <e:worksheet value="#{personList.personList}" var="person"> <e:column> <f:facet name="header"> <e:cell value="First name"/> </f:facet> <e:cell value="#{person.firstName}"/> </e:column> <e:column> <f:facet name="header"> <e:cell value="Last name"/> </f:facet> <e:cell value="#{person.lastName}"/> </e:column> <e:column> <f:facet name="header"> <e:cell value="Age"/> </f:facet> <e:cell value="#{person.age}"/> </e:column> </e:worksheet> </e:workbook>
use case on stereoids
<e:workbook xmlns:e="http://jboss.com/products/seam/excel" xmlns:f="http://java.sun.com/jsf/core"> <e:cellTemplate name="general"> <e:font name="Times New Roman"/> </e:cellTemplate> <e:cellTemplate name="header"> <e:font bold="true" color="white"/> <e:background color="green"/> </e:cellTemplate> <e:cellTemplate name="data"> <e:font italics="true"/> <e:border type="right" color="yellow" lineStyle="thin"/> </e:cellTemplate> <e:worksheetTemplate name="general"> <e:headerFooter type="header"> <f:facet name="left"> <e:headerFooterCommands> <e:headerFooterCommand command="time"/> </e:headerFooterCommands> </f:facet> </e:headerFooter> </e:worksheetTemplate> <e:worksheet value="#{personList.personList}" var="person" templates="general"> <e:mergeCells startColumn="10" startRow="10" endColumn="12" endRow="12"/> <e:cell column="10" row="10" value="Hello World"/> <e:headerFooter type="header"> <f:facet name="right"> <e:headerFooterCommands> <e:headerFooterCommand command="date"/> </e:headerFooterCommands> </f:facet> </e:headerFooter> <e:column autoSize="true"> <f:facet name="header"> <e:cell value="First name" templates="general,header"/> </f:facet> <e:cell value="#{person.firstName}" templates="general,data"> <e:font color="pink"/> <e:background color="periwinkle" pattern="solid"/> </e:cell> </e:column> <e:column> <f:facet name="header"> <e:cell value="Last name" templates="general,header"/> </f:facet> <e:cell value="#{person.lastName}" templates="general,data"/> </e:column> <e:column> <f:facet name="header"> <e:cell value="Age" templates="general,header"/> </f:facet> <e:cell value="#{person.age}" templates="general,data"> <e:numericValidation value="32" condition="greater_equal"/> </e:cell> </e:column> </e:worksheet> </e:workbook>
There is more, have a look at the supported features on the JExcelAPI homepage for hints