非常直接。可以手动选择不同类型的表。 AppleScript Numbers库没有提到可以设置的样式,互联网搜索也没有提供很多结果。有没有人取得过成功或做出了无法完成的最终决定?我希望可以在不使用系统事件的情况下完成,然后点击"桌式。
set newTable to make new table with properties {style:"Something here?", column count:10, header column count:1, footer row count:1, position:{0, 72}, name:"Sample Table", header row count:1, row count:10}
#Or Here?
tell newtable
set style of table somehow?
答案 0 :(得分:0)
技术上是的。您可以在tell newTable
区域中设置行和列的属性。虽然它不是 easy 方式,但如果从头开始构建它仍然可以完成。 (你在做什么)
编辑为了更清楚地说明并包含示例,如果您在识别可以设置的其他属性时遇到问题,可以使用get properties of table 1
来指导您进一步了解库没有多大帮助。获得属性会产生类似于下面的结果。
tell application "Numbers"
get properties of table 1 of sheet 1 of document 1
(* returned from get properties of table
{locked:false, cell range:range "A1:E10" of table 1 of sheet 1 of document id "4F9B1A5C-CC34-4C74-B05C-4856839EE760" of application "Numbers", column count:5, parent:sheet 1 of document id "4F9B1A5C-CC34-4C74-B05C-4856839EE760" of application "Numbers", header column count:1, footer row count:0, class:table, header columns frozen:true, position:{16, 43}, filtered:false, header rows frozen:true, width:490, name:"Table 1", selection range:range "A1:E10" of table 1 of sheet 1 of document id "4F9B1A5C-CC34-4C74-B05C-4856839EE760" of application "Numbers", header row count:1, height:203, row count:10}
*)
get properties of row 1 of table 1 of sheet 1 of document 1
(* returned from get properties of row
{vertical alignment:top, font name:"Helvetica-Bold", class:row, background color:{18205, 30509, 7341}, name:"1", text wrap:true, text color:{65528, 65533, 65524}, alignment:auto align, format:automatic, address:1, font size:10.0, height:20.625}
*)
get properties of column 1 of table 1 of sheet 1 of document 1
(*returned from get properties of column
{vertical alignment:top, font name:"Helvetica-Bold", class:column, background color:{27817, 27821, 27814}, width:98.0, format:automatic, text wrap:true, text color:{65528, 65533, 65524}, alignment:auto align, name:"A", address:1, font size:10.0}
*)
end tell
使用上述内容,您可以看到能够设置的特定特征。然后,您可以在自己的表格中模仿这些设置,如下所示,使用tell newTable
块的轻微混合
tell application "Numbers"
activate
set thisDocument to make new document
tell sheet 1 of thisDocument
delete every table
set newTable to make new table with properties ¬
{name:"Sample Table", position:{16, 43}, column count:5, row count:10, header column count:1, header row count:1, footer row count:1}
tell newTable
set properties of column 1 to {width:216, background color:{27817, 27821, 27814}}
set format of column 2 to checkbox
set properties of column 3 to {width:98, format:currency}
set properties of row 1 to {background color:{18205, 30509, 7341}}
set properties of last row to {background color:{18205, 30509, 7341}}
set value of last cell to "=SUM(E)"
end tell
end tell
end tell
如果您正在寻找非常特定的边框,则可以使用使用所需边框的模板启动文档,因为在该模板中启动的每个表都将是相同的默认表。然而,既然你开始编写它的脚本,并没有特别提到如何更改边框,我的印象是你在颜色,格式和公式而不是边框之后。因此,问题的答案仍然是“技术上是”,您可以通过编程方式设置表格的样式。