Excel attachment should be more user-friendly to create
-------------------------------------------------------
Key: JBSEAM-3948
URL:
https://jira.jboss.org/jira/browse/JBSEAM-3948
Project: Seam
Issue Type: Feature Request
Components: Excel
Affects Versions: 2.1.1.GA
Reporter: Zoltan Tiringer
Excel attachments should be easy to create with syntax similar to that of PDF. I would
like a syntax like this to work:
<m:attachment fileName="people.xls"><ui:include
src="/mail-xls.xhtml" /> </m:attachment>
Workaround exists (thanks, Daniel): Define exportKey in <e:workbook> and then look
it up from context after rendering excel content, then render mail content:
FaceletsRenderer.instance().render("/mail-xls.xhtml");
DocumentData excelData = (DocumentData)
Contexts.getEventContext().get("excelKey");
FaceletsRenderer.instance().render("/mailExcel.xhtml");
In mail definition the looked up DocumentData has to be referenced in the value property:
<m:attachment fileName="people.xls" value="#{excelData}"
contentType="application/vnd.ms-excel"/>
For testing purposes I attach a template that uses the Person class from the mail
example:
<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:e="http://jboss.com/products/seam/excel"
xmlns:f="http://java.sun.com/jsf/core">
<e:workbook type="jxl">
<e:worksheet name="People" value="#{people}"
var="p">
<e:header>
<f:facet name="left">
The date is #date# and the time is #time#
</f:facet>
</e:header>
<e:column style="xls-column-autosize: true">
<f:facet name="header">
<e:cell value="First name" style="xls-font: red bold 10
Verdana"/>
</f:facet>
<e:cell value="#{p.firstname}" />
</e:column>
<e:column style="xls-column-autosize: true">
<f:facet name="header">
<e:cell value="Last name" style="xls-font: red bold 10
Verdana"/>
</f:facet>
<e:cell value="#{p.lastname}" forceType="text"/>
</e:column>
<e:column style="xls-column-autosize: true">
<f:facet name="header">
<e:cell value="Email" style="xls-font: red bold 10
Verdana"/>
</f:facet>
<e:cell value="#{p.address}"/>
</e:column>
</e:worksheet>
</e:workbook>
</html>
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira