2 Replies Latest reply on May 12, 2018 4:38 PM by Michel [FRIdNGE]

    Script to extract column from a table and paste it as a text frame

    el-cerezo

      Hi, everybody!
      I wonder if there's a way —or maybe there's a script that already exist— to convert all columns from all tables in a document to individuals text frames with the same high and widh lenght that had as table columns and preserving the same paragraph style from each cell.

        • 1. Re: Script to extract column from a table and paste it as a text frame
          S Hopkins Adobe Community Professional

          Hi,

          The following sample script demonstrates getting the information you want from a table.

           

          set colInfo to {}

          tell application "Adobe InDesign CC 2018"

            set tableRef to table 1 of story 1 of document 1

            set colList to columns of tableRef

            repeat with i from 1 to length of colList

            set thisCol to item i of colList

            set celList to cells of thisCol

            set wid to width of thisCol

            set totHgt to 0

            set celInfo to {}

            repeat with j from 1 to length of celList

            set thisCel to item j of celList

            set c to contents of contents of thisCel

            set s to applied paragraph style of paragraph 1 of thisCel

            set h to height of thisCel

            set end of celInfo to {c, s}

            set totHgt to totHgt + h

            end repeat

            set end of colInfo to {celInfo, wid, totHgt}

            end repeat

          This creates a nested list of lists that you can then parse to create your text frames with contents and styling. Hope this helps.

          • 2. Re: Script to extract column from a table and paste it as a text frame
            Michel [FRIdNGE] Level 3

            Just by curiosity! … For what use?

             

            Best,

            Michel, from FRIdNGE