取得Word中的游標位置 |
尚未結案
|
adrain
一般會員 發表:39 回覆:28 積分:13 註冊:2004-07-27 發送簡訊給我 |
|
chris_shieh
高階會員 發表:46 回覆:308 積分:240 註冊:2004-04-26 發送簡訊給我 |
procedure TForm1.Button2Click(Sender: TObject); var Word:TWordApplication; _Doc: _Document; colNo, lineNo:String; Template:OleVariant; begin Word:=TWordApplication.Create(self); Word.AutoConnect:=True; Word.AutoQuit:=True; Word.Visible:=True; Template:='C:\test.doc'; _doc:=Word.Documents.Open(Template,EmptyParam,EmptyParam,EmptyParam,EmptyParam,EmptyParam,EmptyParam,EmptyParam,EmptyParam,EmptyParam,EmptyParam,EmptyParam,EmptyParam,EmptyParam,EmptyParam); Showmessage('Move cursor to position you want to show'); //go to the word window and move cursor to somewhere lineNo:=_Doc.ActiveWindow.Selection.Information[wdFirstCharacterLineNumber]; colNo:=_Doc.ActiveWindow.Selection.Information[wdFirstCharacterColumnNumber]; Showmessage('行: ' + lineNo + #10#13 + '欄: ' + colNo) ; end;如上, 所抓到的就是畫面中的資訊 發表人 - chris_shieh 於 2005/01/21 17:51:30 |
adrain
一般會員 發表:39 回覆:28 積分:13 註冊:2004-07-27 發送簡訊給我 |
|
chris_shieh
高階會員 發表:46 回覆:308 積分:240 註冊:2004-04-26 發送簡訊給我 |
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbawd10/html/woproInformation.asp 我猜你是想要這兩項 wdHorizontalPositionRelativeToPage Returns the horizontal position of the specified selection or range; this is the distance from the left edge of the selection or range to the left edge of the page measured in points (1 point = 20 twips, 72 points = 1 inch). If the selection or range isn't within the screen area, returns 1. wdVerticalPositionRelativeToPage Returns the vertical position of the selection or range; this is the distance from the top edge of the selection to the top edge of the page measured in points (1 point = 20 twips, 72 points = 1 inch). If the selection isn't visible in the document window, returns 1. @瞭解越多.懂得越少@ 發表人 - chris_shieh 於 2005/01/21 19:43:37
|
adrain
一般會員 發表:39 回覆:28 積分:13 註冊:2004-07-27 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |