[fpc-pascal] Re: read cells contents from .xls file

Reinier Olislagers reinierolislagers at gmail.com
Wed Oct 2 10:44:02 CEST 2013


On 01/10/2013 21:44, John Lee wrote:
> Thanks for all suggestions. IMO fpspread...pas is too complex for & I'd
> need to hack thro' thousands of lines - maybe a simple program to read
> xls into csv, as in b) below could be added?.
<snip totally irrelevant reference to other programming language>

> Guess one could try to use the excel.dll in te reference in fpc & then
> access it from fpc
Good luck with that. I strongly doubt that dll is procedural, so you'd
have to implement support for C++/.Net (whichever it is) object oriented
DLL calling conventions/object support.

> b) using a <10 line vbs program referenced here to create a csv file
> then getting the data from that   
> 
> http://stackoverflow.com/questions/1858195/convert-xls-to-csv-on-command-line
> 
> This is the way I'm doing it, running the vbs file from cmd using exec
> etc, simple if crude!.  


As already indicated multiple times: fpspreadsheet is about the simplest
code required to read BIFF8 xls files. Of course it can be stripped down
further from a general purpose library to something that just suits your
needs.

You now have indicated multiple times you are not interested in doing
that. Unfortunately for you, I don't think anybody else is, either.

You indicated you wanted to use an outdated FPC compiler to do things
and did not tell you are wililng to use 3rd party tools. Now it turns
out you do use 3rd party tools.

As you indicate: why not simply compile an xls=>csv (or whatever)
converter using a recent FPC+Lazarus+fpspreadsheet and use that, then?
You *don't* need to hack through 1000s of lines of code for that. The
examples on the wiki page indicated already show you the code.
Seems you want others to do all the work for you...

Alternatively, you could use Lazarus opendocument to let Excel open an
.xls file with a VBA macro that converts the data to whatever format you
want, etc.

Good luck.



More information about the fpc-pascal mailing list