用CreateOleObject('Word.Application')创建WordApp变量后,打开一个已存在的word文档
我现在需要用delphi来获取word中的各种属性:
  比如:1。这个word文档的页面高度与宽度、页边距等等
        2。文档中前两段的段落格式,如行间距等
        3。第一段中的第二句话的字体、颜色是什么
我试了一下:想读出文档中第一段的字数,但错误!
var WordApp,WordDoc:OleVariant;
    FileName:OleVariant;
procedure Test;
begin
  FileName:='***.doc'
  Try
    WordApp:=CreateOleObject('Word.Application');
    WordDoc:=WordApp.Documents.open(FileName,ReadOnly:=True,Visible:=False);
    ShowMessage(IntToStr(WordDoc.Paragraphs[1].Words.count));
   ~~~~~~~~出错,说什么“item不是属性”
end;
谢谢大侠们能把我上面的3个例子随便给个例子,