[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. 跨平台的螢幕擷取工具:JShot 
  2. Trac的Issue Ticket狀態管理 (1)
  3. [OOo] 預設格式(Default Formatting)的用途 
  4. 簡單比一比:funP麻吉與豆瓣網 
  5. [Vista] 常用快捷鍵彙總 
  6. 取得iReport / JasperReports報表內特定元件的方法 [修訂] 
  7. [轉貼] 架站好書,極度推薦《站長親授! WordPress 3.0 部落格架站十堂課》 (2)
  8. 強化閱讀第2噗:變更噗浪回應的字體與背景顏色 (10)
  9. 全面做好GTD任務管理:Toodledo、TaskUnifier與Pocket Informant (10)
  10. 用svchost viewer檢視始終是個謎的svchost.exe (3)

歷史熱門文章

  1. 如何手動輸入Plurk的表情圖示? (368,442 點擊/2008-09-29)
  2. 啟用&關閉中華電信ZyXEL P874的無線網路連線功能的步驟[修訂] (120,465 點擊/2011-06-01)
  3. Plurk CSS樣式自訂修改全攻略 (89,475 點擊/2009-07-04)
  4. 簡單放大Plurk輸入區的方法[修訂] (88,895 點擊/2008-09-29)
  5. 網路升級光世代50M/3M與設定ZyXEL P874 (72,187 點擊/2011-05-28)
  6. 輕鬆學會彈指神功-揭露AutoHotkey絕技 (50,919 點擊/2008-04-10)
  7. iPad新手入門技巧 (49,436 點擊/2011-02-05)
  8. iPad鍵盤輸入全攻略 (42,911 點擊/2011-01-01)
  9. 分享世博台灣館主題曲『台灣的心跳聲』MV(附歌詞+下載連結+新歌詞) (40,929 點擊/2010-04-27)
  10. 調整Windows 7環境: 加回工作列的「顯示桌面」圖示 (40,856 點擊/2010-01-02)