Applescript 数字表格的样式可以通过编程方式设置吗

Applescript 数字表格的样式可以通过编程方式设置吗,applescript,Applescript,非常直截了当。有不同样式的表可供手动选择。AppleScript数字库没有提到可以设置的样式,而且互联网搜索也没有显示太多结果。是否有人取得了成功,或做出了无法实现的最终决定?我希望它可以在不使用系统事件“单击”表格样式的情况下完成 set newTable to make new table with properties {style:"Something here?", column count:10, header column count:1, footer row c

非常直截了当。有不同样式的表可供手动选择。AppleScript数字库没有提到可以设置的样式,而且互联网搜索也没有显示太多结果。是否有人取得了成功,或做出了无法实现的最终决定?我希望它可以在不使用系统事件“单击”表格样式的情况下完成

        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?

技术上是的。您可以在
tell newTable
区域中设置行和列的属性。虽然这不是一个简单的方法,但是如果你从头开始构建它,它仍然可以实现。(你正在做的事情)

编辑如果您在识别可设置的其他属性时遇到困难,您可以使用
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
如果要查找非常特定的边框,可以使用使用所需边框的模板启动文档,因为在该模板中启动的每个表都是相同的默认表。然而,由于您从一开始就在编写脚本,并且没有特别提到如何更改边框,我的印象是您关注的是颜色、格式和公式,而不是边框。因此,问题的答案仍然是“技术上是”,您可以通过编程设置表的样式