*
The moose likes XML and Related Technologies and the fly likes How to produce multi-sheet excel output with XSLT Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "How to produce multi-sheet excel output with XSLT" Watch "How to produce multi-sheet excel output with XSLT" New topic
Author

How to produce multi-sheet excel output with XSLT

Duran Harris
Ranch Hand

Joined: Nov 09, 2008
Posts: 598

Hi all,

What library can I use to produce multi-sheet excel output with XSLT ?

Thanks


===>SCJP 1.5(72%)<===
==>SCWCD1.5(76%)<===
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41034
    
  43
xslt is for producing text, not binary output. You need to use a library like Apache POI.


Ping & DNS - my free Android networking tools app
Duran Harris
Ranch Hand

Joined: Nov 09, 2008
Posts: 598

But isn't POI for producing Excel like :

Workbook w = new Workbook();
Cell c = new Cell();

ie creating excel files from Java?

Isn't there some way to specify that the output of my xsl can be excel format..in the same way that you can produce a pdf with xsl-fo?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Duran Harris wrote:Isn't there some way to specify that the output of my xsl can be excel format..in the same way that you can produce a pdf with xsl-fo?

No.
Duran Harris
Ranch Hand

Joined: Nov 09, 2008
Posts: 598

Okay but I found this post on StackOverflow that seems to be doing what I want? http://stackoverflow.com/questions/2160159/create-excel-speadsheetml-output-with-xslt
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41034
    
  43
If it does what you need done - great! But it sure doesn't create an Excel file. (And SpreadsheetML is obsolete to begin with.)

Have you considered creating a CSV file? All versions of Excel can import those.
Duran Harris
Ranch Hand

Joined: Nov 09, 2008
Posts: 598

You say that it doesn't create an excel file...I was under the impression that the spreadsheetML would be able to be opened as an excel spreadsheet?

A csv would be great except for the fact that I need multiple sheets...I dont need formulas or anything else like that,
I just need my data on multiple sheets.. would spreadsheetML output not do this properly?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Duran Harris wrote:I was under the impression that the spreadsheetML would be able to be opened as an excel spreadsheet?


Seems to me that it shouldn't be hard to set up a test which would answer that question...
Duran Harris
Ranch Hand

Joined: Nov 09, 2008
Posts: 598

Yes I ran the xml and xsl through the org.apache.xalan.xslt.Process class and was rewarded with some spreadsheetML...
But if I try open it with Open Office as a spreadsheet it opens Open Office Writer with the text content instead although
I did save the output of the transformation as .xls ...
Maybe I should spend a couple weeks figuring out this xsl stuff before I waste more time on this.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41034
    
  43
I don't think there ever was an application besides MS Office that could make sense of the Office 2003 XML formats. This has nothing to do with XSLT.
Duran Harris
Ranch Hand

Joined: Nov 09, 2008
Posts: 598

Okay I think I'll give up on this one for the time being..
Although Open Office Calc 2.0 does have the option of "Excel 2003 XML *.xml" in it's file open dialog...This gave me the wrong idea
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to produce multi-sheet excel output with XSLT
 
Similar Threads
JasperReport question (outputting to excel)
. reading data from MS EXcel using apache poi api
Download excel file with images
XML to excel using xslt
WA #1.....word association