cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ruslan Cheremin" <chere...@mosinfo.ru>
Subject Re: [Cocoon-Users] how to extract XML->Excel transformation from cocoon? -- solution
Date Tue, 01 Feb 2005 16:34:50 GMT
Thanks for all for your help, I've found what I need in POI users list
The code sniplet is:

File infile = new
    File( "c:/jtrump/test/test.xml" );
  File outfile = new
    File( "c:/jtrump/test/test.xls" );

  try {
   outfile.createNewFile();
   OutputStream fos = new FileOutputStream( outfile );
   SAXBuilder builder = new SAXBuilder();
   Document doc = builder.build( infile );

   HSSFSerializer hssf = new HSSFSerializer();
   hssf.initialize();
   hssf.setOutputStream( fos );

   SAXOutputter saxOutput = new SAXOutputter( hssf );
   saxOutput.output( doc );

   System.out.println( "Done" );
  } catch ( Exception e ) {
   e.printStackTrace();
  }

where test.xml is xml file in Gnumeric format.


----- Original Message ----- 
From: <irv@dotech.com>
To: <users@cocoon.apache.org>; "Ruslan Cheremin" <cheremin@mosinfo.ru>
Cc: <users@cocoon.apache.org>
Sent: Tuesday, February 01, 2005 6:04 PM
Subject: Re: [Cocoon-Users] how to extract XML->Excel transformation from cocoon?


> Ok, if you want that out of cocoon, you need to look in src/blocks/poi
> 
> The end class that is used in cocoon is
> org.apache.cocoon.serialization.HSSFSerializer.  It extends through two
> classes, both are in the same directory.  They make use of helper components
> that are in org.apache.cocoon.components, right in the same block.  
> 
> Hopefully that gets you started.  I didn't dig too much into the code to see how
> it would be easily extracted.
> 
> Irv
> 
> Quoting Ruslan Cheremin <cheremin@mosinfo.ru>:
> 
> > Thanks for your reply...
> > 
> > As I can see, POI project give me the possibility to read, create, modify
> > .xls files.
> > We use now POI in our project to create .xls output. But we do it by  series
> > of call
> > like createCell(..), setCellStyle(...) etc. Thing what I need, is ablility to
> > use xsl to 
> > transformation -- it's mach easy and prefferable for us by different reasons.
> > I don't
> > see this ability in POI project.
> > 
> > As for XHTML issue -- yes, thanks for idea, but we need exactly the .xls
> > file. But I'll
> > check, may be we can use this idea in for local purpose
> > 
> > Ruslan.
> > 
> > 
> > 
> > > You can use the POI project directly if you want:
> > > 
> > > http://jakarta.apache.org/poi/
> > > 
> > > The other option we have used on our projects (not sure if it works for
> > you) is
> > > that you can send simple XHTML to excel and it will read it fine.  You can
> > even
> > > put in specific xml things for excel in it. (For formulas, etc)  They
> > recently
> > > "open sourced" their Office 2003 XML formats.  We have found this is easier
> > and
> > > better to use that going to the native excel formats:
> > > 
> > > http://www.microsoft.com/office/xml/default.mspx
> > > 
> > > Irv
> > >  
> > > Quoting Ruslan Cheremin <cheremin@mosinfo.ru>:
> > > 
> > > > Good day,
> > > > 
> > > > I'm searching the way to easy transformate data in xml file to excel
> > format.
> > > > Cocoon does the thing,
> > > > but I need to intergate this feache in may application -- I don't want
to
> > run
> > > > cocoon only for make
> > > > fo transformation. So, my question is: I can make xsl transformation and
> > get
> > > > xml with <gmr:... />
> > > > markup in my own app. So, I need only last step -- serialize this xml
to
> > > > .xls. Can I (and how I can)
> > > > extract from cocoon only this functionality? Some class, what got an
> > xml-dom
> > > > with gmr-markup
> > > > and give .xls?
> > > > 
> > > > Thanks!
> > > > 
> > > > 
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > > > For additional commands, e-mail: users-help@cocoon.apache.org
> > > > 
> > > 
> > > 
> > > 
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > > For additional commands, e-mail: users-help@cocoon.apache.org
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > For additional commands, e-mail: users-help@cocoon.apache.org
> > 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message