在uses添加:ComObj
修改为
var
wordapp,doc:Variant;
i:integer;
begin
wordapp:=CreateOleObject('Word.application');
try
do
c:=wordapp.Documents.Open(FileName:=OpenDialog1.FileName);
后运行,显示上边的最后一行“命令失败”
改成
wordapps:=CreateOleObject('Word.Application');
try
if OpenDialog1.Execute then
do
c:=wordapps.Documents.open(OpenDialog1.FileName)
else
Memo1.clear;
for i:=1 to wordapps.Paragraphs.count do
memo1.lines.add(doc.Paragraphs.item(i).range.text);
// memo1.Lines.SaveToFile('d:/d.txt');
finally
wordapps.Quit;
end;
在Paragraphs处失败……
html文件打开方法中的IHtmlDocument2是虾米?能给出完整的吗?