the command for text objects:
convertToTable ([columnSeparator: string][, rowSeparator: string][, numberOfColumns: number=1])
Thanks! but I have no idea how to do it!
@traveldis2 – see the following example:
//Let's assume that we selected one single text frame only: var myTextFrame = app.selection; //You can access the whole story of the text frame (and all of its threadded text frames) by: var myStory = myTextFrame.parentStory; //Then we need the "texts" object of that story: var myTexts = myStory.texts; //We now can convert that "texts" object to a table: //First argument is the column separator string (in this case a "tabulator") //Second argument in this case is different from the first one and represents the row separator (a "return") //Both arguments are separated by a "comma" myTexts.convertToTable("\t","\r");
That would convert the story to a table, but we have no immediate access to that table, if we want to format it, etc.pp.
So we could shorten the above code a bit and getting access to the table by introducing a variable for our table:
//If you want to work on with the table, you'll need a handle on it. That means a variable for the table: //And we could write this a little shorter: var myTable = app.selection.parentStory.texts.convertToTable("\t","\r"); //The default width of the table is the width of the first container of the story. //All columns are devided evenly in width. //If you do not want that, adjust the width of all the columns in one go: //Example with Millimeter unit: myTable.columns.everyItem().width = "25 mm";