Re: How to build a program that can read the content of a very simple MS Excel file?



On Wed, Jun 13, 2007 at 08:24:49AM +0700, Huge Mountain wrote:
Hello everyone.
I'm trying to build a program to read the content of a Microsoft Excel file,
just read a very simple Excel file (a file with text in cell A1, A2,...,
don't care about formula, chart,...). I simply want to read the content of
cell A1.  With that, I can get the binary format of MS Excel file more
clearly.
Ex:if cell A1 have the content: "text message", my program can show "text
message" as result.
Could someone tell me how to do that, or where to find the references? I
downloaded source, file "gnumeric-1.6.3.tar.gz" from
http://www.gnome.org/projects/gnumeric/, but I don't know how to use, which
to compile. I'm stray  with >1000 files (some file I don't know how to
open).
Please help me!
Thank in advance!

The simplest starting point would be to use gnumeric's 'ssconvert'
program from the command line to convert a .xls file into a
.gnumeric, which is really just gzipped xml.
 
PS:  I explored a simple MS Excel file (with "abc" in cell A1, this file was
saved by MS Excel 2000). This file have 3 stream: SummaryInfomation stream,
DocumentSummaryInfomation stream and Workbook stream. The only stream I care
is Workbook stream, started from byte 512 to byte (512+4096) (this stream
has the 4096 bytes length). So, where are bytes which contain the "abc"
string of cell A1 in this 4096 bytes?

You can use some of the test programs in libgsf (eg test-msole1) to
dump the raw data out of the Workbook stream, but that is unlikely
to be useful to you.  Gnumeric's excel plugin
(plugins/excel/ms-excel-read.c) can parse the content of Workbook
(or BOOK in earlier versions) and transform them into something
useful.  Have a look at the code for ssindex as an example of an
application that reads a spreadsheet file (any of the formats
gnumeric handles) and dumps the string contents.  That is easily
modifiable into something you could use.

Good Luck
    Jody



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]