Microsoft KB Archive/150447

= FILE: How to Create a BIFF5 File =

Article ID: 150447

Article Last Modified on 8/18/2005

-

APPLIES TO


 * Microsoft Excel Software Development Kit 5.0, when used with:
 * Microsoft Excel 95 Standard Edition

-



This article was previously published under Q150447



SUMMARY
BIFF is a file in the Microsoft Download Center that demonstrates how to create a file using the Microsoft Excel Binary Interchange File Format (BIFF) version 5.



MORE INFORMATION
The following file is available for download from the Microsoft Download Center:

Biff.exe

For additional information about how to download Microsoft Support files, click the following article number to view the article in the Microsoft Knowledge Base:

119591 How to Obtain Microsoft Support Files from Online Services

Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help to prevent any unauthorized changes to the file.

The BIFF sample is a console application that prompts the user to input a path and file name. Once the user inputs this information, it writes a BIFF5 file to the name and location specified. The BIFF5 file that is created is simply an empty spreadsheet. It contains the minimum records necessary for this task.

NOTE: You must provide a unique name for the file. BIFF does not overwrite an existing file. Also, the directory location specified must exist in advance: BIFF will not create it.

BIFF5 files are Compound Files, which means that the OLE Structured Storage interfaces must be used to write the file. The necessary steps to do this are explicitly documented in the main function comments in BIFF.CPP.

Additionally, because we are using OLE, the following issues exist:
 * 32-bit OLE methods and functions that work with strings expect to receive UNICODE strings. One solution to this is to build this application for UNICODE. However, this is not required. The application handles the problem by converting the necessary strings to UNICODE through the use of the MultiByteToWideChar function and the L macro (for string literals). The necessary conversion code is conditionally compiled if you choose not to build for UNICODE.
 * Because of the way that OLE interfaces are implemented, (they are identical to a C++ Vtable) it is much easier to develop in C++ than in C. If you want to re-write this in C, please refer to Chapter 7 (p. 349) in the Microsoft Excel Developer's Kit version 5 for hints on how to accomplish this.

To construct the BIFF5 records themselves, I have implemented a set of functions that convert a string of hexadecimal characters to binary data. These functions can be found in hex2byte.cpp.

Files
BIFF.CPP / .H         Contains the console application entry point and support functions, as well as the functions to                      create the BIFF file.

HEX2BYTE.CPP / .H     Contains the functions to convert a hexadecimal formatted string to binary data.

BIFF.MAK              Makefile for the project.

To Build
This project must be built as a 32-bit application. You can build for either Unicode or ANSI. You can use NMAKE with the attached makefile to build this project.

Additional query words: biff biff.zip

Keywords: kbhowto kbdownload kbnoupdate kbfile kbsample KB150447

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.