Alternative code ships with Displaytag itself to do that. You need to
do two things:

*) In your "displaytag.properties" file, add this line:

export.excel.class=org.displaytag.export.excel.DefaultHssfExportView

That tells Displaytag to use the "real" Excel exporter.

*) Make sure you've got the following jar files:

lib/displaytag-export-poi-1.2.jar
lib/poi-3.2-FINAL-20081019.jar
lib/poi-contrib-3.2-FINAL-20081019.jar
lib/poi-scratchpad-3.2-FINAL-20081019.jar

The last three are from the Apache POI project.

Now, that'll get you Excel files, but it remains the case that the
control you have over
how table values are transformed into spreadsheet cells is pretty limited.


On Wed, Feb 11, 2009 at 2:32 AM, J Ilari Moilanen
<imoil...@cc.helsinki.fi> wrote:
> Hi
> The trouble you have there is that displaytag does not produce "real"
> excel files. They are pretty much the same as the csv (comma separated
> value) files. If you open the produced xls file with text editor you can
> see it yourself. If you compare it with the binary file that Microsoft
> Excel makes they look nothing alike (altough the produced files may be
> legitimate excel files still... don't know for sure).
>
> So I think that if you want to make real excel files that have the column
> type setted and so on, you need to replace the
> org.displaytag.export.ExcelView class with implementation that produces
> excel files that are more like the files that MS Excel creates. As fas ar
> I know.
> There may be open source java libraries available in the net that make
> this doable. I didn't try to google for them though.
>
> Regards,
> Ilari
>
>
>> Date: Tue, 10 Feb 2009 15:58:45 +0000 (GMT)
>> From: ffjavierr...@yahoo.es
>> To: displaytag-user@lists.sourceforge.net
>> Subject: [displaytag-user] Export to excel and numbers???
>>
>> Hello,
>>
>> I am trying to export my table to excel. The data are exported ok, but excel 
>> donÿÿt realize that a column have numbers. The code in my JSP is:
>>
>> <display:column media="excel pdf xml" titleKey="myTitle" 
>> property="contador"/>
>>
>> and the method in the Table Decorator is:
>>
>> public Integer getContador()
>> {
>>       return new Integer(this.getListIndex()+1);
>> }
>>
>>
>> I have tryed too with a column without decorator like this:
>>
>> <display:column sortable="true" media="pdf excel xml "property="contadorInt" 
>> total="true" titleKey="myTitle"/>
>>
>> but I have the same problema.
>>
>> I have tryed with "format" attribute too, but I canÿÿt put a number.
>>
>> How could I export to excel a column with numbers? Now this column is a text 
>> in the excel exported
>>
>> Thanks
>
>
>
>
>
>
> --
>
> "Friends come and go, but enemies accumulate."
>
> ------------------------------------------------------------------------------
> Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
> software. With Adobe AIR, Ajax developers can use existing skills and code to
> build responsive, highly engaging applications that combine the power of local
> resources and data with the reach of the web. Download the Adobe AIR SDK and
> Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
> _______________________________________________
> displaytag-user mailing list
> displaytag-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/displaytag-user
>



-- 
Turtle, turtle, on the ground,
Pink and shiny, turn around.

------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
_______________________________________________
displaytag-user mailing list
displaytag-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/displaytag-user

Reply via email to