How to generate/export OpenOffice Calc(Spreadsheet) using Java?

Hi,

Anybody know how to generate/export OpenOffice Calc(Spreadsheet) using Java?
I know how to generate Windows Excel document by using JExcel API, but how do I do it for OpenOffice or StarOffice?

Please advise, Thanks.
rospccAsked:
Who is Participating?
 
objectsConnect With a Mentor Commented:
> 2. Can't compile sample codes (Most crucial one), it says:
>     package com.sun.star.document does not exist

Have you made the classes available to youyr classpath

0
 
objectsCommented:
0
 
objectsCommented:
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
rospccAuthor Commented:
Thanks for the reply objects, Is it possible to generate chart if using your XML method?
0
 
objectsCommented:
0
 
rospccAuthor Commented:
I don't understand the sample which was written in Phyton.
Do you know whether is there any samples which is written using Java?
How do I write java to xml?
0
 
objectsCommented:
Heres how to write an XML file:

http://www.javaalmanac.com/egs/javax.xml.transform/WriteDom.html

And lots of other examples for dealing with XML:

http://www.javaalmanac.com/cgi-bin/search/find.pl?words=xml
0
 
objectsCommented:
0
 
rospccAuthor Commented:
By using the XML method to create CALC document, do I need to use java to write all these files: content.xml, styles.xml, meta.xml, settings.xml, META-INF/manifest.xml ?
How do I convert all the Java created xml mentioned above into OpenOffice Spreadsheet document programatically?

I found out that there's 2 ways to create OpenOffice documents using java:
1. XML (As what you suggested)
2. OpenOffice SDK

Do you think is it easier to generate using OpenOffice SDK?
0
 
objectsCommented:
> Do you think is it easier to generate using OpenOffice SDK?

Haven't used it but I would it would be easier.
0
 
rospccAuthor Commented:
For XML method:
Firstly, do I need to use java to write all these files: content.xml, styles.xml, meta.xml, settings.xml, META-INF/manifest.xml ?
How do I convert all the Java created xml mentioned above into OpenOffice Spreadsheet document programatically?
0
 
objectsCommented:
Open Office documents *are* XML files.
0
 
rospccAuthor Commented:
I see..which means after I've created the xml using java, I need to zip them back into one file (.sxc) ?
Is there a way to use Java to zip those xml files into one file (.sxc) programmatically?
0
 
objectsCommented:
I'd look at what the OO api supportsd first, most likely will save you some work

http://api.openoffice.org/docs/DevelopersGuide/Spreadsheet/Spreadsheet.htm
0
 
rospccAuthor Commented:
I can't seem to install and use the SDK successfully.
Are you able to use it?

I got the following problems:
1. The link is broken for downloading makefile, Does it cause the API not to work?
2. Can't compile sample codes (Most crucial one), it says:
      package com.sun.star.document does not exist
3. There this command that I need to invoke, but how do I know which port should I use?
    soffice "-accept=socket,host=localhost,port=8100;urp;StarOffice.ServiceManager"
      
0
 
rospccAuthor Commented:
It's working now..some of the classpath missed out.
Thanks objects.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.