I am just upgrading some old code written in Delphi 6 to Delphi XE2. Unfortunately the code references a Word97 COM object for generating some .doc documents. There is a direct uses clause of Word97 in the code.
I have to keep the document generated in the same Word format as it is used by an old Crystal Report and another 3rd party app which requries that format of the document.
So, to the question. Because I am using the Word97 in the uses clause, the compiler complains about Types of actual and formal var parameters must be identical whenever an EmptyParam variable is used. This is coming straight out of the Word97.pas source file. This is because EmptyParam is now declared as a function and not a variable.
what is the best way to deal with this? Should I copy the Delphi 6 source files (Word97.pas et al) say into my local directory, directly add them to my project, together with System.Variants.pas and change the Compiler Directive of my app to include EMPTYPARAM_VAR? I haven't tried that, but hopefully it would declare EmptyParam as a variable then. Or perhaps there's an easier solution.
Thanks
EDIT
Here's a little more background info, even though I have accepted an answer, for future reference. Here's an example of the code (AddClaimsLetter is the "Application" COM object - ie TWordApplication):
AddClaimsLetter.Documents.Open(Wordfile, EmptyParam, EmptyParam,
EmptyParam, EmptyParam, EmptyParam, EmptyParam, EmptyParam,
EmptyParam, EmptyParam, EmptyParam, EmptyParam);
Without changing anything, the EmptyParam arguments here failed at compile time stating "E2033 Types of actual and formal var parameters must be identical".
However, because I wanted to keep Word97 (which is in OCX/Server in Delphi 6 Ent. installation folder), I did need to copy the .pas files into my local project file and declare a variable that was used in place of EmptyParam (because these files attempted to compile too and I got the same compiler error as above).
So all working now, but I might discuss with management upgrading to a later version of Office for this App!
Thanks
EmptyParam
to any of the parameters infunction Open(var FileName: OleVariant; var ConfirmConversions: OleVariant; var ReadOnly: OleVariant; var AddToRecentFiles: OleVariant; var PasswordDocument: OleVariant; var PasswordTemplate: OleVariant; var Revert: OleVariant; var WritePasswordDocument: OleVariant; var WritePasswordTemplate: OleVariant; var Format: OleVariant; var Encoding: OleVariant; var Visible: OleVariant; var OpenAndRepair: OleVariant; var DocumentDirection: OleVariant; var NoEncodingDialog: OleVariant): WordDocument; safecall;
– user743382var
, but they are. And now thatEmptyParam
is a function, it's no longer a valid function argument for avar
parameter. – user743382