跳轉至內容

OpenOffice.org/宏

來自華夏公益教科書

如果你想執行重複性任務,使用宏自動執行是最佳選擇。宏是一系列用於計算機執行的指令。宏被廣泛應用於 Microsoft Office 的專業人士和專家使用者。OpenOffice.org 也可以執行宏。OpenOffice.org 可以透過 OpenOffice.org Basic(最簡單、最常用的語言)、Python、Beanshell 和 Javascript 進行指令碼編寫,此功能更廣為人知的是宏。

想象一下你有十二個電子表格需要在頁尾中新增你的姓名,將第一行設定為粗體,並將第四列突出顯示為紅色。如何在不逐個進行操作的情況下完成這些步驟?答案是錄製一個宏。

一個簡單的名為 Main 的宏,用於在 OpenOffice.org Basic 中將縮放比例縮放到 75%。

sub Main
rem ----------------------------------------------------------------------
rem define variables
dim document   as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document   = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")

rem ----------------------------------------------------------------------
dim args1(2) as new com.sun.star.beans.PropertyValue
args1(0).Name = "Zoom.Value"
args1(0).Value = 75
args1(1).Name = "Zoom.ValueSet"
args1(1).Value = 28703
args1(2).Name = "Zoom.Type"
args1(2).Value = 0

dispatcher.executeDispatch(document, ".uno:Zoom", "", 0, args1())


end sub
[編輯 | 編輯原始碼]

通用宏幫助

[編輯 | 編輯原始碼]
華夏公益教科書