#13
#10
算不算字符
procedure TForm1.Button1Click(Sender: TObject);
var
FileName : OleVariant;
Index1,Index2 : OleVariant;
S : string;
begin
wa.Connect ;
FileName := 'F:/Programs/Test/word/aaa.doc';
Index1 := 1;
Index2 := 20;
wa.Documents.Open(FileName,EmptyParam,
EmptyParam,EmptyParam,EmptyParam,EmptyParam,
EmptyParam,EmptyParam,EmptyParam,EmptyParam);
s := wa.ActiveDocument.Range(Index1,Index2).Get_Text;
Button1.Caption := S;
wa.Quit;
wa.Disconnect ;
end;
另外:改名的时候要注意过滤文件名中不允许的字符