5 Replies Latest reply on Oct 16, 2008 7:20 AM by (Robert_Tkaczyk)

    CS3 table geometry and page breaks

    (Maximilian_Gaerber)
      Hi all,

      I am writing a script that has to determine where (what row) a table continues on a new page and set an visual indicator (arrow graphic) to show that this is a continued table.

      First Problem: I can get the Page number of each Row by iterating through the Cells and calling on the first Character's parent TextFrame and then up to Page. Strangely, InsertionPoint doesn't work here and sometimes it could be that there is no character at all...

      Second Problem: I need to place the graphic in the upper left corner of the first cell. But there is no way (other than using InsertionPoint) to get geometric bounds of the cell.

      Regards

      Max
        • 1. Re: CS3 table geometry and page breaks
          Level 1
          for first problem - try this:

          myCell.Texts.Item(1).InsertionPoints.Item(1)

          instead of:

          myCell.InsertionPoints.Item(1)

          robin

          --
          www.adobescripts.com
          • 2. Re: CS3 table geometry and page breaks
            (Maximilian_Gaerber) Level 1
            Hi,

            thanks! This seems to work (any clue where the difference is?).

            For my second Problem:

            I am adding a Rectangle now at the first InsertionPoint in the needed cell.
            How would I position the Rectangle to ignore the Cell's padding and not to interfere with the existing content?
            Could I still put the Rectangle on another layer (even if anchored)?

            Regards,

            Max
            • 3. Re: CS3 table geometry and page breaks
              Level 1
              empty Cell or Cell with overset - don't have contents - parent .Texts.Item(1) object - it is always and always hold contents of Cell (even if Cell is empty - there is one InsertionPoint)

              Anchored objects can't be moved to different layer

              the solution - it depends of what you try to achieve and how stable is contents of your document, etc.

              robin

              --
              www.adobescripts.com
              • 4. Re: CS3 table geometry and page breaks
                (Maximilian_Gaerber) Level 1
                Hi,

                I managed to create an ObjectStyle that positions the Rectangle correctly. Then I do sendToBack()

                Hope this does the trick...

                Another issue is that now I need to place an image (EPS) on the Rectangle but this doesn't work using:

                topLeftStyle = app.activeDocument.objectStyles.item("top_left_arrow");

                var rightPageImg = new File("tbl_continued-right.eps");

                var firstInsert = table.rows[0].cells[0].texts[0].insertionPoints[0];

                var firstRect = firstInsert.rectangles.add();

                firstRect.place(rightPageImg); //<-- ERROR HERE

                firstRect.applyObjectStyle(topLeftStyle, true);

                Regards,

                Max
                • 5. Re: CS3 table geometry and page breaks
                  Level 1
                  why you try to add Rectangle to First cell in table - rather first cell on current page ? ;)

                  do you see newly added Rectangle in first cell in table?
                  you can't place image to invisible Rectangle

                  if you add Rectangle to cell and it is to big to fit in cell - cell will be overset and you will get error when you try to place image in invisible rectangle

                  workaround:
                  - add new Rectangle somewhere on any page,
                  - place your image,
                  - resize it, rescale, whatever :)
                  - make reference to it (A),
                  - now, when you will process your tables - every time when you need to add this arrow: select (A), copy it, select insertion point, place :)

                  this will speed up your script :)
                  if you don't use copy/paste in your script - you can just use only "select destination insertion point" and "place" command - your Rectangle is in clippoard :)

                  robin

                  --
                  www.adobescripts.com