@Green – Hm. How would you do that task in the UI?
I think duplication of the texts object that holds the table would do
(not tested yet).
@Green – Now testing. The following snippet is working:
//Selection is a text frame that holds nothing but a table: var sel = app.selection; sel.characters.duplicate(LocationOptions.AFTER,sel.insertionPoints[-1]);
To get to the specific character you want to duplicate you could also use the storyOffset property of a table object.
That gives you the insertion point before the character that represents the whole table.
In my case the selection is whole table. In that case what would be a good idea. Because the table is selected in a automated process.
//Selection must be a whole table var sel = app.selection; sel.storyOffset.paragraphs.duplicate(LocationOptions.AFTER, sel.storyOffset.paragraphs.insertionPoints[-1]);
You can test this code....
1 person found this helpful
@Green – I would try the following (just tested and does work):
var myTable = app.selection;//[object Table] var myInsertionPoint = myTable.storyOffset; //[object InsertionPoint] var imyInsPointIndex = myInsertionPoint.index; //Number var myStory = myInsertionPoint.parentStory; //[object Story] var myCharThatHoldsMyTable = myStory.characters[imyInsPointIndex]; myCharThatHoldsMyTable.duplicate(LocationOptions.AFTER,myStory.insertionPoints[-1]);
Yeah It's working good. A good and neat approach to dupliacte the table. Thanks for you.
OT: I think adobe should look into this, and consider including method table.duplicate()