2006年05月8日
[OOo] 跳頁的巨集--更新
由OOoForum.org看到的巨集:直接跳到某一頁。在自訂裡把這個巨集指派給按鍵Ctrl+G,以達成和Word類似的功能。若不透過這個巨集的話,目前OpenOffice.org Writer必須用助手窗才能跳頁。
2006/05/11 加強版:
##
| 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 |
##
引用URL
http://cgi.blog.roodo.com/trackback/1555995
