代码之家  ›  专栏  ›  技术社区  ›  Ian Turner

访问iWork编号中的单元格属性

  •  1
  • Ian Turner  · 技术社区  · 16 年前

    tell application "Numbers"
    tell document 1
    repeat with i from 1 to count of sheets
    tell sheet i
    repeat with j from 1 to count of tables
    tell table j
    try
    set currentCell to the first cell of the selection range
    return name of currentCell
    end try
    end tell
    end repeat
    end tell
    end repeat
    end tell
    end tell
    

    {column:column "A" of table "Table 1" of sheet "Sheet 1" of document "Untitled" of
     application "Numbers", alignment:center, value:0.0, background color:{59111, 59111, 
    59111}, text color:{0, 0, 0}, font size:10.0, vertical alignment:top, name:"A1",
     class:cell, font name:"HelveticaNeue", format:automatic, row:row "1" of table "Table
     1" of sheet "Sheet 1" of document "Untitled" of application "Numbers", text 
    wrap:true}
    

    因此,单元格的column属性似乎包含完整引用,但如果我直接通过column属性访问引用。 有谁能给我一些指导,告诉我如何使用applescript获取工作表和文档。

    干杯

    伊恩

    1 回复  |  直到 11 年前
        1
  •  1
  •   Ian Turner    16 年前

    tell application "Numbers"
    tell document 1
        repeat with i from 1 to count of sheets
            tell sheet i
                repeat with j from 1 to count of tables
                    try
                        tell table j
                            set currentCell to the first cell of the selection range
                            set therow to row of currentCell
                            set sheetNumber to i
                        end tell
                    end try
                end repeat
            end tell
        end repeat
        return name of sheet sheetNumber
    end tell
    end tell
    

    可以使用类似代码检查文档编号