[prev in list] [next in list] [prev in thread] [next in thread] 

List:       koffice-devel
Subject:    Re: export excel
From:       "T.J. Mather" <tjmather () maxmind ! com>
Date:       2002-11-10 15:28:14
[Download RAW message or body]

On Fri, 8 Nov 2002, Fred Malabre wrote:

> What is Apache POI?

Apache POI contains HSSF which is a library for reading and writing Excel
files.  It is 58745 lines of Java code and developed by several 
developers.

> I've never thought about mixing Java code with C++ code for a C++ program.
> Isn't that messy to do that? Is there parts of KOffice doing that?

It's possible to invoke GCJ compiled Java code from C++, see
http://gcc.gnu.org/onlinedocs/gcj/Invocation.html

> I know Java pretty well (it's what I use at work), but I don't feel like using 
> it on KDE.

As Nicolas said, he who writes the code decides how it is written.

> So, you guys believe it's a bad idea to write a filter from scratch? I've 
> never done that, neither looked any code from KOffice, so I may have no clue 
> where I'm going...

My opinion is that for MS filters it's best to try to re-use an existing 
library if at all possible, because the MS Formats are very difficult to 
read and write, and they may make future formats harder to reverse 
engineer.  Apache POI is already an excellent library for Excel and is 
widely used, so it will probably support any future MS file formats.

I was able to get Apache POI to compile down to a shared library by
compiling *.java -> *.class using Sun JDK, then running
gcj -shared -o poi.so `cat classlist` where the classlist contained the
core HSSF files (not the ones that used Swing, etc).  I had to compile
FormulaParser.java and HexRead.java to *.class using GCJ, because I got
a "bad pc in exception_table" if I tried to compile the JDK *.class to
*.so using GCJ.  Also note that *.java -> *.class using GCJ doesn't
work for some *.java files.

So the next step is going to be to write a simple export filter that
invokes the code in libpoi.so and writes out a Excel spreadsheet.  I'll
let the list if this ends up working.

-TJ

_______________________________________________
koffice-devel mailing list
koffice-devel@mail.kde.org
http://mail.kde.org/mailman/listinfo/koffice-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic