帮助!我正在尝试自动更正以富文本格式存储在访问数据库中的条目。如果我使用 autocorrect.entries.Add 但使用 autocorrect.entries.AddRichText 失败,它可以正常工作。看看下面的代码。我会很感激你的帮助!
procedure TfrmdxForm.acBtnClick(Sender: TObject);
var
DXRANGE, DXWORD: oleVariant;
DXSTR: STRING;
begin
DXWORD := CreateOleObject('Word.Application');
DXWORD.Visible := FALSE;
MyADODataSet.First;
while NOT MyADODataSet.Eof do
begin
DXRANGE:= MyADODataSet.FieldByName('DX').Text;
// here is where it fails … I don't know how to change this to a range
DXSTR := MyADODataSet.FieldByName('DXCODE').Text;
DXWORD.Autocorrect.Entries.AddRichText(DXSTR, DXRANGE);
// here it works if I use Add but it fails with AddRichText
MyADODataSet.Next;
end;
DXWORD.QUIT;
end;