我可以使用以下方法在Numbers电子表格中设置单元格的格式:
tell application "Numbers"
activate
tell document 1
tell active sheet
set the selectedTable to ¬
(the first table whose class of selection range is range)
end tell
tell selectedTable
tell column "J"
set the format of cell 3 to number
end tell
end tell
end tell
end tell
但是,如何设置单元格的小数位数?
不幸的是,AppleScript数字字典不支持设置小数位,但是您可以使用GUI脚本来设置。
由于GUI脚本在很大程度上取决于软件版本,因此这是为了 Numbers 3.6.2
tell application "Numbers"
activate
tell document 1
tell active sheet
set the selectedTable to ¬
(the first table whose class of selection range is range)
end tell
tell selectedTable
tell column "J"
set the format of cell 3 to number
end tell
end tell
end tell
end tell
tell application "System Events"
tell process "Numbers"
tell radio group 1 of window 1
if value of radio button "Cell" is 0 then
click radio button "Cell"
repeat until value of radio button "Cell" is 1
delay 0.2
end repeat
end if
end tell
tell text field 1 of scroll area 4 of window 1
set value of attribute "AXFocused" to true
set value to "2"
keystroke return
end tell
end tell
end tell
在英语以外的其他系统语言中,文字字符串Cell
可能已本地化。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句