Copy link to clipboard
Copied
Hi,
I am working on a script for InDesign and apart of the script involves creating a table. Everything is working well, except for the creation of my table. I think I may have missed a few steps along the way. Can anyone help? The scripting guide states that a table can be created at an insertion point of a story. I think this is the part that I am missing.
I tried to create a text frame and then insert the table into the text frame. When I enter the following code from the reference guide, I get an error.
tell insertion point -1
set myTable to make table
set column count of myTable to 3
set body row count of myTable to 3
end tell
Thanks in advance!
Copy link to clipboard
Copied
Hi,
You can get a reference to an insertion point using (1) reference to an insertion point in a story; or (2) using the selection list object:
(1) reference to insertion point in a story
tell application "Adobe InDesign CC 2017"
tell document 1
tell story -1
set insPt to insertion point 1
end tell
tell insPt
set myTable to make table with properties {column count:3, body row count:3}
end tell
end tell
end tell
(2)
tell application "Adobe InDesign CC 2017"
set selList to selection
if class of item 1 of selList is insertion point then
set insPt to item 1 of selList
tell insPt
set myTable to make table with properties {column count:3, body row count:3}
end tell
end if
end tell
Copy link to clipboard
Copied
Check this link to create a table
Find more inspiration, events, and resources on the new Adobe Community
Explore Now