#include <vcl.h>
#pragma hdrstop
#include "word01.h"
#include <Word_2K_SRVR.h>
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "Word_2K_SRVR"
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::btnRunClick(TObject *Sender)
{
AnsiString WordFile="C:\\001.doc";
try
{
WordApp->Connect();
WordApp->Documents->Open(WordFile);
WordDocument->ConnectTo(WordApp->Documents->Item(Variant(1)));
WordApp->Application->Visible=true;
}
catch(...)
{
ShowMessage("您可能没有安装word!");
WordApp->Disconnect();
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::btnEndClick(TObject *Sender)
{
Close();
}
错误提示:
[C++ Error] word01.cpp(26): E2285 Could not find a match for 'Documents::Open(AnsiString)'
5 个解决方案
#1
AnsiString WordFile="C:\\001.doc";
TVariant ov = WordFile;
WordApp->Connect();
WordApp->Documents->Open(&ov, TNoParam(), TNoParam(), TNoParam(), TNoParam(),
TNoParam(), TNoParam(), TNoParam(), TNoParam(), TNoParam());
...
#2
因为高版本的BCB已经没有word这套组件了,建议不要用它。
#3
怎么又出现这种错误了呢?请赐教,多谢了。
#4
完整的代码呢?
#5
重装了系统就好使了,谢谢妖哥!
#1
AnsiString WordFile="C:\\001.doc";
TVariant ov = WordFile;
WordApp->Connect();
WordApp->Documents->Open(&ov, TNoParam(), TNoParam(), TNoParam(), TNoParam(),
TNoParam(), TNoParam(), TNoParam(), TNoParam(), TNoParam());
...
#2
因为高版本的BCB已经没有word这套组件了,建议不要用它。
#3
怎么又出现这种错误了呢?请赐教,多谢了。
#4
完整的代码呢?
#5
重装了系统就好使了,谢谢妖哥!