ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to create a Excel Workbook natively (https://www.excelbanter.com/excel-programming/305822-how-create-excel-workbook-natively.html)

Rainer Queck

How to create a Excel Workbook natively
 
Hi,

I started writing me a Excel Exporter. Up to now I can generate a simple worksheet as an xls file that opens nicely with Excel. Here the records I write up to now:

SheetBof //Identifier:= $809 type $10 Worksheet
RKValue(1) // Identifier:= $27E
......
RKValue(n) // Identifier:= $27E
SheetEof // Identifier:= $0A

As I said, that works nicely. But now I would like to create a Excel Workbook that holds a couple of Sheets. I thought this would work some how like :

WorkbookBof //$809 type $100 Workbook globals
SheetOffset
SheetHeader
SheetBof //Identifier:= $809 type $10 Worksheet
RKValue(1) // Identifier:= $27E
......
RKValue(n) // Identifier:= $27E
SheetEof // Identifier:= $0A
WorkbookEof

But the generated File can not be read by Excel. I know that the given information is not engough to tell where the problem is located exactly, but is the "way" the right one, or am I missing some important records?

Thanks for hints
Rainer

Tom Ogilvy

How to create a Excel Workbook natively
 
I don't know much about the Excel file format, but I suspect you are writing
an xl4 format file. That file format only supported single sheet workbooks.
When excel 5 came out with Multisheet workbooks, the format was encased in
the Compound document format.

I think you would need to learn the compound document format as it is
implemented in Excel to write multisheet files.

--
Regards,
Tom Ogilvy

"Rainer Queck" wrote in message
...
Hi,

I started writing me a Excel Exporter. Up to now I can generate a simple
worksheet as an xls file that opens nicely with Excel. Here the records I
write up to now:

SheetBof //Identifier:= $809 type $10 Worksheet
RKValue(1) // Identifier:= $27E
......
RKValue(n) // Identifier:= $27E
SheetEof // Identifier:= $0A

As I said, that works nicely. But now I would like to create a Excel
Workbook that holds a couple of Sheets. I thought this would work some how
like :

WorkbookBof //$809 type $100 Workbook globals
SheetOffset
SheetHeader
SheetBof //Identifier:= $809 type $10 Worksheet
RKValue(1) // Identifier:= $27E
......
RKValue(n) // Identifier:= $27E
SheetEof // Identifier:= $0A
WorkbookEof

But the generated File can not be read by Excel. I know that the given
information is not engough to tell where the problem is located exactly, but
is the "way" the right one, or am I missing some important records?

Thanks for hints
Rainer



Rainer Queck

How to create a Excel Workbook natively
 
Hi Tom,

I think you would need to learn the compound document format as it is
implemented in Excel to write multisheet files.

Thanks for that hint.
Is there some where in www a document available that explains (fairly easy)
how to generate this format ?

Regards
Rainer



Tom Ogilvy

How to create a Excel Workbook natively
 
Easy?, I doubt it. But here are some sources of information:

http://support.microsoft.com/default...b;en-us;840817
Information about how to extract Office file formats and schema
(contains several links - also, if you will only be working with xl2002 or
later, using XML may be the preferred approach. Other alternatives include
using CSV if you are only sending data, not formatting and so forth.)

http://sc.openoffice.org/excelfileformat.pdf

http://support.microsoft.com/default...b;en-us;150447
FILE: How to Create a BIFF5 File

http://homepage.tinet.ie/~jmcnamara/...lExcelFaq.html



4.2 The OLE Compound document format
The BIFF data is stored along with other data in an OLE Compound File. This
is a structured storage which acts like a file system within a file. A
Compound File is comprised of storages and streams which, to follow the file
system analogy, are like directories and files.

The documentation for the OLE::Storage module,
http://user.cs.tu-berlin.de/~schwartz/pmh/guide.html , contains one of the
few descriptions of the OLE Compound File in the public domain.

Another useful source the cole libraries which form part of the filters
project http://arturo.directmail.org/filtersweb/ .

The source code of the Excel plugin for the Gnumeric spreadsheet also
contains information relevant to the Excel BIFF format and the OLE
container, http://www.gnumeric.org/ .


2 Q147732 - Records Needed to Make a BIFF5 File Microsoft Excel Can Use
3 Q150447 - FILE: How to Create a BIFF5 File
4 Q184647 - Xl97: BIFF Records Documentation Error in MS Excel 97
Developer's Kit
5 Q207475 - DOC: Excel BIFF8 CONTINUE Record Information Is Incomplete
6 Q239653 - INFO: Support for the Microsoft Office Binary File Formats
7 Q269168 - HOWTO: Distinguish Between Excel 97 and Excel 2000 Files
8 Q147942 - DOCERR: Microsoft Excel's Internal Format Table Doc Has Errors
9 Q179886 - XL2000: List of Supported File Formats in Microsoft Excel 2000
10 Q224518 - HOWTO: Determine If an Excel Workbook Contains Macros

--
Regards,
Tom Ogilvy



"Rainer Queck" wrote in message
...
Hi Tom,

I think you would need to learn the compound document format as it is
implemented in Excel to write multisheet files.

Thanks for that hint.
Is there some where in www a document available that explains (fairly

easy)
how to generate this format ?

Regards
Rainer





Rainer Queck

How to create a Excel Workbook natively
 
Hi Tom,

Easy?, I doubt it. But here are some sources of information:

Thanks for the links. Looks like a lot to read ;-)

Regards
Rainer




All times are GMT +1. The time now is 12:24 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com