我有一个问题,我希望有人能够提供帮助...
我希望在新的iWorks Pages文档中自动生成包含数据的多个表。
在线有很多与在Numbers中这样做相关的信息,但在Pages文档中这样做绝对没什么可帮助的,而且方法似乎略有不同。
我试图生成的表是一个简单的表,其中包含标题列,然后是数据,例如
Column1 Column2 Column3 Column4
data data hello data
moredata moredata data hello
data data data data
可以在Microsoft Word中执行以下操作:
tell application "Microsoft Word"
set myDoc to make new document
set myTable to make new table at myDoc with properties ¬
{allow auto fit:true, allow page breaks:true, column options:¬
{default width:1.0, preferred width:25, preferred width type:¬
preferred width percent}, number of columns:¬
4, number of rows:12, spacing:2.0}
end tell
但是如何在页面中完成?
非常感谢您的帮助,谢谢
答案 0 :(得分:2)
以下是一个示例,这适用于页面
的最新版本tell application "Pages"
set myDoc to make new document
tell page 1 of myDoc to set myTable to make new table with properties {column count:4, row count:12}
tell cell range of myTable
set width of columns to 120
set text wrap to true
set alignment to center
-- to set value of the headers and some cells
set j to 1
repeat with i in {"Column1", "Column2", "Column3", "Column4", "data cell 1", "data cell 2", "hello", "data cell 4", "moredata", "moredata", "data", "hello"}
set value of cell j to i
set j to j + 1
end repeat
end tell
end tell