[jbossseam-issues] [JBoss JIRA] Commented: (JBSEAM-2896) component set for generating excel documents

Nicklas Karlsson (JIRA) jira-events at lists.jboss.org
Fri May 16 16:01:22 EDT 2008


    [ http://jira.jboss.com/jira/browse/JBSEAM-2896?page=comments#action_12413103 ] 
            
Nicklas Karlsson commented on JBSEAM-2896:
------------------------------------------

A small update. Daniel will zip up the code and attach it here soonish, I'll try to describe the current state of the tag structure for feedback.

The minimal (ok, the header facet can still be dropped) iterating case still looks something like

{code:xml}
<e:workbook type="jxl" 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:worksheet name="People" value="#{excelTest.people}" var="person">
		<e:column>
			<f:facet name="header">
				<e:cell value="Name" />
			</f:facet>
			<e:cell value="#{person.name}"/>
		</e:column>
	</e:worksheet>
</e:workbook>
{code}

while the maxcase could look something like

{code:xml}
<e:workbook 
	type="jxl"
	rationalization="true" 
	templateURI="file:///c:/template.xls" 
	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">

	<!-- cell templates -->	
	<e:cellTemplate name="global" alignment="center">
		<e:font name="Times New Roman"/>
		<e:background color="pink" pattern="grey_25"/>
		<e:border border="all" lineStyle="thick" color="red"/>
	</e:cellTemplate>

	<e:cellTemplate name="header">
		<e:font size="20" color="white"/>
		<e:background color="yellow"/>
		<e:border border="left" lineStyle="thin" color="blue"/>
	</e:cellTemplate>

	<e:cellTemplate name="data">
		<e:font bold="true"/>
		<e:border border="right" lineStyle="double" color="green"/>
	</e:cellTemplate>
	
	<!-- worksheet templates -->	
	<e:worksheetTemplate name="general" copies="5">
		<e:printArea firstColumn="1" firstRow="3" lastColumn="3" lastRow="10"/>
		<e:printTitles firstColumn="1" firstRow="2" lastColumn="3" lastRow="2"/>
		<e:headerFooter type="header">
			<f:facet name="left">
				<e:headerFooterCommands>
					<e:headerFooterCommand command="time"/>
				</e:headerFooterCommands>
			</f:facet>
		</e:headerFooter>
	</e:worksheetTemplate>
	
	<!-- a worksheet -->	
	<e:worksheet 
		name="People" 
		value="#{excelTest.people}"
		startColumn="1"
		startRow="3" 
		var="person"
		paperSize="a4"
		templates="general">
		
		<!-- appended header (to "general" template) -->
		<e:headerFooter type="header">
			<f:facet name="right">
				<e:headerFooterCommands>
					<e:headerFooterCommand command="page_number"/>
				</e:headerFooterCommands>
			</f:facet>
		</e:headerFooter>
		
		<!-- worksheet level items -->
		<e:cell column="0" row="0" value="Hello world!" templates="global">
			<e:font struckOut="true"/>
		</e:cell>
		<e:formula column="1" row="0" value="X1+X2"/>
		<e:hyperLink startColumn="2" startRow="0" URL="http://www.seamframework.org" description="Seam"/>
		<e:image URI="file:///c:/img.jpg" startColumn="3" startRow="0"/>
		
		<!-- a column -->
		<e:column autoSize="true">
			<f:facet name="header">
				<e:cell value="Name" templates="global,header"/>
			</f:facet>
			<e:cell value="#{person.name}" templates="global,data" rendered="#{person.name=='Mike'}">
				<e:font color="white"/>
				<e:background color="black"/>
			</e:cell>
			<e:cell value="#{person.name}" templates="global,data" rendered="#{person.name!='Mike'}">
				<e:font color="white"/>
				<e:background color="black"/>
			</e:cell>
		</e:column>
		
	</e:worksheet>
	
	<!-- Another plain worksheet on the same excel sheet (due to same name) -->
	<e:worksheet 
		name="People" 
		value="#{excelTest.people}"
		startColumn="5"
		startRow="3" 
		var="person">
		
		<e:column>
			<f:facet name="header">
				<e:cell value="Name" templates="global,header"/>
			</f:facet>
			<e:cell value="#{person.name}" templates="global,data"/>
		</e:column>

	</e:worksheet>
	
</e:workbook>
{code}

which describes two merged datasets into a worksheet, cascading cell formats and worksheet settings etc.

> component set for generating excel documents
> --------------------------------------------
>
>                 Key: JBSEAM-2896
>                 URL: http://jira.jboss.com/jira/browse/JBSEAM-2896
>             Project: Seam
>          Issue Type: Feature Request
>          Components: JSF Controls
>    Affects Versions: 2.0.2.CR1, 2.1.0.A1, 2.0.1.GA
>            Reporter: Dan Allen
>             Fix For: The future
>
>   Original Estimate: 1 week
>  Remaining Estimate: 1 week
>
> We should mirror the functionality of creating PDF documents from Facelets templates and create a component set that generates excel documents. There are two approaches we can take. One approach is to use POI to build the document structure and then export it. The second approach is to build an XML document that Excel can understand. Technically there is no reason to actually produce a binary Excel document as long as we can feed something that Excel knows how to convert. Regular CSV support would be nice too, but I always find that to be such a cop out.
> Creating this module shouldn't be too technically challenging since most of the infrastructure has been set up already when creating the PDF components. In fact, i would start by working in that module and then split it out into another JAR.
> Some resource links:
> http://www.codeproject.com/KB/office/excelxmllibrary.aspx
> http://xelem.sourceforge.net/

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the seam-issues mailing list