Re: Creating an Excel file?
- Posted by Michael Sabal Jul 03, 2008
- 785 views
Does anyone have code to create simple Excel files in Euphoria? I know you can write a CSV file and Excel will open the file, but I am hoping to provide a bit for formatting. I am not against using DDE type code if necessary, but was hoping to be able to use do something like:
integer fh = open("file.xls", "wb") addCell(fh, 1, 1, "Name", {"font=bold", "size=15"}) addCell(fh, 2, 1, "John", {}) addCell(fh, 2, 1, "Jane", {}) -- etc...
or something like that. May be asking too much.
Jeremy
Your best bet is to create an HTML table and save it with an XLS extension. MS Excel will be quite happy to read it completely formatted as if it were a BIFF8/OLE2 (Excel's native format) file. OpenOffice, however, will try to open the file with Writer instead of Calc. The demo in the archives uses BIFF2, which is a very old format that modern versions of Excel have trouble with. OpenOffice, however, reads it just fine.
Contrary to common sense, Microsoft Office files are really FAT file systems, with indexed tables and pointers all over the place. I have a very limited program to read BIFF8 files, but haven't been successful with writing them, and haven't tried too hard since the HTML option is so much easier.