[OOo] 跳頁的巨集–更新

OOoForum.org看到的巨集:直接跳到某一頁。在自訂裡把這個巨集指派給按鍵Ctrl+G,以達成和Word類似的功能。若不透過這個巨集的話,目前OpenOffice.org Writer必須用助手窗才能跳頁。

Sub JumpToPage ‘Goes to home position on page X. Tap Space Bar

  ‘to get the view there.

  oVC = thisComponent.CurrentController.getViewCursor

  Do

    sAns = InputBox("Enter the page below.","JUMP TO PAGE")

    If sAns = "" then End

  Loop Until isNumeric(sAns)

  oVC.jumpToPage(Cint(sAns)) ‘If beyond end, you get the last page.

End Sub

2006/05/11 加強版:

Global PriorPjcv as String
Sub GoToPage
  Def = PriorPjcv
  Def = Lcase(Def)
  oVC = thisComponent.CurrentController.getViewCursor
  CurrentP = oVC.getPage
 
  If Not ShowDef then Def = ""
  Info = "目前頁碼= " & CurrentP
  If PriorPjcv <> "" then Info = Info & "  先前頁碼= " & PriorPjcv
  a$ = "請輸入頁碼。" & Chr(10)
  a$ = a$ & "若有目錄等文前部份,附加一個空白和偏移量;"
  a$ = a$ & "例如:7 14會跳到文前第14頁後的第7頁。"
  a$ = a$ & "前n頁或後n頁請用 -n 或 +n。"
  sAns = InputBox(a$,"[移動頁碼] " & Info,Def)
  If sAns = "" then End
 
  b = split(sAns) : c = b(0) : d = 0
  I = Instr("+-",Left(c,1))
 
  If I > 0 then
    PlusMinus = true
    If I = 1 then c = Mid(c,2) ‘Another + sign we need to get rid of.
  EndIf
  If ubound(b) > 0 then d = b(1)
  If Not isNumeric(c) Or Not isNumeric(d) then GoToPage()
  c = Cint(c) : d = Cint(d)
  If PlusMinus then
    p = CurrentP + c + d
  Else
    p = c + d
  EndIf
  If p < 1 then
    MsgBox("頁碼必須由 1 開始。",,"輸入結果 =  " & p)
    GoToPage()
  EndIf
  oVC.jumpToPage(p) ‘If beyond end, you get the last page.
  PriorPjcv = CurrentP
End Sub

##

您可能也會有興趣的類似文章

填寫回應

 

 

 

您可使用這些HTML標籤

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">

隨機文章

  1. 在字裡行間發出嗡嗡聲:LineBuzz–線上註解服務 (1)
  2. iPad Dropbox能分享My Dropbox裡的所有檔案連結?! 
  3. 公告:暫停更新五天 (4)
  4. Aqua Data Studio簡易操作文件 
  5. FireFox擴充: Diggler 用來簡化網址欄位的操作 
  6. Google Alerts (快訊)介紹 
  7. [轉貼] 將照片變成漂亮又炫的數位相簿 
  8. 自己當倉頡:打造自己的輸入法 (5)
  9. 因公出差,本日誌將呈半打烊狀態 (2)
  10. 敗了Sumdex的筆記型電腦專用背包 

歷史熱門文章

  1. 如何手動輸入Plurk的表情圖示? (353,056 點擊/2008-09-29)
  2. 簡單放大Plurk輸入區的方法[修訂] (86,924 點擊/2008-09-29)
  3. 啟用&關閉中華電信ZyXEL P874的無線網路連線功能的步驟[修訂] (83,953 點擊/2011-06-01)
  4. Plurk CSS樣式自訂修改全攻略 (83,109 點擊/2009-07-04)
  5. 網路升級光世代50M/3M與設定ZyXEL P874 (53,282 點擊/2011-05-28)
  6. 輕鬆學會彈指神功-揭露AutoHotkey絕技 (43,158 點擊/2008-04-10)
  7. iPad新手入門技巧 (40,414 點擊/2011-02-05)
  8. 分享世博台灣館主題曲『台灣的心跳聲』MV(附歌詞+下載連結+新歌詞) (38,149 點擊/2010-04-27)
  9. 把HTC Touch HD操作介面換成Spb Mobile Shell,美觀又便利! (37,954 點擊/2009-02-18)
  10. 另一套適用手機的影片轉檔工具:WinAVI 3GP/MP4/PSP/iPod Video Converter (35,920 點擊/2009-04-18)