Page 1 of 1

Wrapper for libxl, Apache POI or OpenOffice?

Posted: Fri Oct 29, 2010 9:35 pm
by sigmason
I'm looking to use an Excel spreadsheet as a template and fill it with data.
I don't want to have to have Excel present to pull this off.

I can use the OpenOffice automation bridge on Windows to do this, but frankly, I'd like to be able to make this work in Linux as well and usually in Linux/Mac OSX OpenOffice uses either a steam or socket to transact API control.

Since I don't want to have Excel, using VBA (even though Mac Office 2011 has VBA again) doesn't help. It also doesn't help there's no Linux version of Microsoft Office at all.

I've been digging around and the choices seem to be to wrap all or part of Apache POI:
http://poi.apache.org/

Create a socket based wrapper for OpenOffice (which will work in Windows, I just tested it very simply):
http://www.openoffice.org/
http://www.documentfoundation.org/

I found a product called OfficeWriter that's .NET and really server oriented so not what I really want:
http://officewriter.softartisans.com/

However, I found LibXL and being a C library with the headers I'm wondering as well if someone here has already wrapped it?
http://libxl.com/

The upside for LibXL would be they offer it on Linux, Mac OSX and Windows and they offer each platform at $200 for the license which isn't too bad for the amount I'm planning on using it (I have no relation to this company and am not currently a customer).

Thanks for any help in this regard...

Re: Wrapper for libxl, Apache POI or OpenOffice?

Posted: Fri Oct 29, 2010 11:02 pm
by IdeasVacuum
Well, sRod has written a grid gadget for Windows, and he supplies the PB source code with it. Perhaps you can ask sRod if the source is adaptable for Mac and Linux.

http://www.purebasic.fr/english/viewtopic.php?t=26647
http://www.nxsoftware.com/

Re: Wrapper for libxl, Apache POI or OpenOffice?

Posted: Sat Oct 30, 2010 12:30 am
by sigmason
IdeasVacuum wrote:Well, sRod has written a grid gadget for Windows, and he supplies the PB source code with it. Perhaps you can ask sRod if the source is adaptable for Mac and Linux.
I'm aware of this software, in fact I've been in communication with him recently about it.

The problem I have is that I need the result to be in Microsoft Excel and I need the template to be in Microsoft Excel.

I have a very good reason for this. It means that anyone with Excel can make or alter the template and they can export the results into the template so it looks nice. If I used the other method the current best I could do is export a CSV file. However then I'd need some VBA to integrate it. I absolutely need the end result in Excel for a particular set of projects. Otherwise I could use QuickPDF or NXSoftware's Artic Reporting. QuickPDF you could probably create a PDF template for with PDFill (under $35). However, the report design tool Pyrex for Artic Reporting is not a standard so far as I know and it's not royalty free to distribute (under $65).

Since I need Microsoft Excel output anyway, I figured for the modest effort using Excel to make the template would do the trick. In that sense I could even use OpenOffice to make the template or look at the results (assuming the template doesn't exploit some bizarre Excel feature OpenOffice/LibreOffice can't handle yet).

Re: Wrapper for libxl, Apache POI or OpenOffice?

Posted: Sat Oct 30, 2010 12:33 am
by sigmason
I suppose I should add that while you can build an OLE DB link to Excel, this would require Excel to be present. Further it's a problem when you're not on Windows if you think about.

Re: Wrapper for libxl, Apache POI or OpenOffice?

Posted: Sat Oct 30, 2010 9:31 am
by srod
sigmason wrote:I suppose I should add that while you can build an OLE DB link to Excel, this would require Excel to be present. Further it's a problem when you're not on Windows if you think about.
That is not entirely correct - only the relevant OLE-DB providers need to be installed. You can write to existing xls sheets using ODBC (via the Jet drivers) but of course this is Windows only. I do not know if there are similar ODBC drivers for Linux?

Re: Wrapper for libxl, Apache POI or OpenOffice?

Posted: Sun Oct 31, 2010 6:41 am
by Rook Zimbabwe
Why don't you create your spreadsheet and your template BEFORE the fact save a copy of them as the new file and use your app to just enter the data in the correct column/cell/page?

Simple no?

Re: Wrapper for libxl, Apache POI or OpenOffice?

Posted: Sun Oct 31, 2010 9:38 am
by sigmason
Rook Zimbabwe wrote:Why don't you create your spreadsheet and your template BEFORE the fact save a copy of them as the new file and use your app to just enter the data in the correct column/cell/page?

Simple no?
That is exactly what I'm trying to do. I suppose it would be easier if I stuck with the XML formats as they basically could be worked with as text files, but I was hoping to support the older formats.

Re: Wrapper for libxl, Apache POI or OpenOffice?

Posted: Sun Oct 31, 2010 9:41 am
by sigmason
srod wrote:
sigmason wrote:I suppose I should add that while you can build an OLE DB link to Excel, this would require Excel to be present. Further it's a problem when you're not on Windows if you think about.
That is not entirely correct - only the relevant OLE-DB providers need to be installed. You can write to existing xls sheets using ODBC (via the Jet drivers) but of course this is Windows only. I do not know if there are similar ODBC drivers for Linux?
There is a package for OLE DB in Linux and even ODBC, but I think it's only databases. It's part of Mono:
http://www.mono-project.com/OLE_DB

Re: Wrapper for libxl, Apache POI or OpenOffice?

Posted: Sun Oct 31, 2010 10:10 am
by srod
OBC on Windows treats an .xls sheet as a database anyhow so there's no distinction to be made on that score.

Re: Wrapper for libxl, Apache POI or OpenOffice?

Posted: Sun Oct 31, 2010 12:40 pm
by sigmason
srod wrote:OBC on Windows treats an .xls sheet as a database anyhow so there's no distinction to be made on that score.
True the usage is similar but if the back end doesn't exist it doesn't help much.

Outside of Mono, it appears unixODBC doesn't itself have an Excel backend (at least not shown in the first few pages of Google).

There is an ODBC/ODBC bridge from EasySoft:
http://www.easysoft.com/products/data_a ... index.html

However, I'm figuring that will require a Windows computer to bridge with, if not at least an instance of wine.