> I am trying to create myself a BIFF 5 xls file. > > If I write a file with only the documented fields, than the file is not > recognized by excel : it crashes ! Biffview also does not recognize the > file as an xls one. > > All the fields are read from a real xls file. But this xls file has many > undocumented fields that I do not use. I must include these fields to > create a recognized xls file. > (The addresses of the data are relative, so I do not have to modify the > indexes) > > First, a file created by excel has a 512 bytes header not mentioned at all > in the documentation. Next, the documentation inform us about the existence > of the "PivotTable1 cache", "CompObj", "VBA" and "Summary Info" streams and > says that they are not documented ! > > The file format is described in the MSDN library disks and in Miscrosoft > Excel 97 Developper's Kit. > > Does anybody know how to create a proper xls file, will be very kind to > help me in my first steps. > > Thanks First, the undocumented header is probably an OLE document header. I can't remember which version of Excel introduced the OLE compound file, but the new office documents are all based on it. The BIFF records are inside the OLE compound document. Second: I've done a biff file before. I wrote BIFF5, as it required much less in the extra style records that are required of the higher versions of BIFF, and the new versions of excel still understand older BIFF. (this may kill me with future versions of excel) The records I had to write, (from looking at old code) were: BOF Dimensions Number (or whatever your records are) ... Number LABEL (if you are defining names, they should all be defined together) ... LABEL EOF At least that is what I seemed to be writing in my file filter. The important thing is that you've got to remember to have your BOF record with the correct values in it. I've built a set of interdependent classes for the BIFF record types that I was using. Here's the declaration: short int vers;// 2 Version number (0500 for BIFF5) short int dt;// 2 Substream type:0005h = Workbook globals0006h = Visual Basic module0010h = Worksheet or dialog sheet0020h = Chart0040h = Microsoft Excel v4.0 macro sheet0100h = Workspace file short int rupBuild;// 2 Build identifier (internal use only) short int rupYear;// and here's my default initialization: vers = 0x0500; dt = 0x0010; rupBuild = 0x0c92; rupYear = 1996; From looking at this, I seem to remember that the build and year had to be there, or excel would not load the file. I figured it out by creating tiny excel files, and dumping them with the dumpbiff utility. Having access to old versions of excel also helped. (or at least extremely old excel files sitting on the network.) Also, some of the comments are copied directly from various versions of the developer network.