我的作業要參考word_tlb.pas這個檔案,故我先要創建這個word_tlb.pas檔案。我是如下做的。
delphi中project-import type library-add-c:\program files\microsoft office\office11\msword.olb-打開-選擇create unit,這樣就創建了word_tlb.pas檔案,我在我的工程中users處參考word_tlb.
運行工程就出現如下錯誤:
[Error] Word_TLB.pas(34708): Operator not applicable to this operand type
[Fatal Error] Unit1.pas(7): Could not compile used unit '..\Imports\Word_TLB.pas'
錯誤的代碼段是word_tlb.pas內的
procedure TWordDocument.InvokeEvent(DispID: TDispID; var Params: TVariantArray);
begin
case DispID of
-1: Exit; // DISPID_UNKNOWN
4: if Assigned(FOnNew) then
FOnNew(Self);
5: if Assigned(FOnOpen) then
FOnOpen(Self);
6: if Assigned(FOnClose) then
FOnClose(Self);
7: if Assigned(FOnSync) then
FOnSync(Self, Params[0] {MsoSyncEventType});
8: if Assigned(FOnXMLAfterInsert) then
FOnXMLAfterInsert(Self,
IUnknown(TVarData(Params[0]).VPointer) as XMLNode {const XMLNode},
Params[1] {WordBool});
9: if Assigned(FOnXMLBeforeDelete) then
FOnXMLBeforeDelete(Self,
IUnknown(TVarData(Params[0]).VPointer) as Range {const Range},
IUnknown(TVarData(Params[1]).VPointer) as XMLNode {const XMLNode},
Params[2] {WordBool});
end; {case DispID}
end;
不知怎么修改,請求幫助.
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/149117.html
標籤:VCL組件開發及應用
上一篇:步步鬧心-記網購春運火車票
