Storing and Accessing Data in an Excel Worksheet At that time, I will present a discussion of the relative merits of working with variants and interfaces.
#DELPHI INSERT INTO WORD DOCUMENT AT CURSOR HOW TO#
However, in Part II of the paper I will return to this subject, and show you how to work with interfaces. Throughout this part of the paper, I will ignore these interfaces, and show you how to work directly with variant objects.
The Pascal translations of the interfaces to all the objects used in Excel or Word are found in the files created by importing EXCEL8.OLB and MSWORD8.OLB. On my system, I found these entries in the. The file to use with Word is MSWORD8.OLB, and the one to use with Excel is EXCEL8.OLB. When working with Office 97, however, you want one with an OLB extension. The files you want to import usually have either a TLB or EXE extension. This is a Delphi keyword, and so we append a space on to the end of it, converting the word End to End_. For instance, Excel uses End in several places. For instance, if Excel uses an Object Pascal keyword in its code, then we need to make an alias for that keyword. Most of these warnings have to do with name conflicts. There will be a number of warnings at the top of the type library, but you can ignore them. (Be sure you are using Delphi 3.01 or later when importing the type library, as some important fixes were made to this technology between Delphi 3.0 and Delphi 3.01.) A Delphi translation of the type library will be created automatically. However, if you want to create your own versions of these libraries, then you can select Project | Import Type Library from the Delphi menu, and then select the appropriate type library.
I have included the translations of the Excel and Word type libraries with this article. Obviously, this is the preferred technique.