2 Replies Latest reply on Jan 22, 2013 12:39 PM by KuddRoww

    Duplicating Tables

    KuddRoww Level 1

      There's a lot of things that I like about the way that tables are setup. Among them the idea I can assign contents to a table and have them fill to the correct cell as long as the data is formatted correctly.

       

      However two things irk me about tables:

           1) They have no geometric bounds.

           2) You can't use the duplicate method on them.

       

      Why are tables setup like this? It seems to me that tables are interfaced with in a way that no other objects are.

       

      Thanks for your thoughts.

        • 1. Re: Duplicating Tables
          Peter Kahrel Adobe Community Professional & MVP

          1. Tables live in paragraphs, even constitute paragraphs, and since paragraphs have no geometric bounds, tables therefore have no geometric bounds either. But you can still get some information (a table's storyOffset returns an insertionPoint):

           

          // Right-hand side of the table:

          myTable.storyOffset.paragraphs[0].endHorizontalOffset

           

          // Bottom of the table:

          t.storyOffset.baseline

           

          // Left-hand side of the table:

          myTable.storyOffset.horizontalOffset

           

          The top of the table is either the top of the text frame (if the table is in the first paragraph of a text frame) or can be derived from the baseline of the preceding paragraph.

           

           

          2. Since tables live in their own paragraphs, and paragraphs can be duplicated, duplicating the table's parent paragraph therefore duplicates the table. To duplicate a table at the end of the story it occurs in, use this:

           

           

          myTable.storyOffset.paragraphs[0].duplicate (LocationOptions.after, myTable.storyOffset.parentStory.insertionPoints[0]);

           

           

          Peter

          1 person found this helpful
          • 2. Re: Duplicating Tables
            KuddRoww Level 1

            Peter this was very helpful.

             

            Thank-you!