5 Replies Latest reply on Jul 29, 2009 11:24 PM by rajeshselvaraju

    Problems with tables, pages and autoflow

      Hi to everybody,
      I'm writing a javascript that creates a catalogue by copying a model structure into cells of tables. Each brand of the catalogue has is own table, this way it's possible after the importation of the xml (which contains the properties of the catalogue) to remove some articles preserving the layout.
      But I have some problems:

      1 - How may I create a text-frame in a right page when pages of my document are paired? I tried for example to insert a text frame in the third page (which is in the right side) with:
      > var mytextframe = myDocument.pages.itemByName("3").textFrames.add();
      the problem is that always it put my text frame in the left page (in this case it puts it in the second page)

      2 - How my I make the tables and their contents to be displayed along all the pages i have created, that is how may I do an autoflowing by script? For the insertion of contents in the cell I use the method I've seen in this forum, with the function placeAsset. and i create the table with
      > mytable = myTextFrame.tables.add()

      I hope I've been clear and I thanks very much in advance everyone may help me! Thanks!!
        • 1. Re: Problems with tables, pages and autoflow
          Level 1
          Well I've found the error in my script for the first problem.. It was an error in my function used to resize the textFrame after having created it, so that it was created in the right page but after it was moved from is right position.
          But I still have the second problem, that is someone knows if it'is possible to flux a table over all the pages it needs to be all displayed? Something like the autoflowing option of the function Place of the object Page? Thanks a lot.
          Stefano
          • 2. Re: Problems with tables, pages and autoflow
            Peter Kahrel Adobe Community Professional & MVP
            Stefano,

            You'll need to do the flowing yourself. I use the function below for that. It keeps adding pages and text frames, linking each new text frame to the previous thread, as long as the last added text frame overflows. It may not work for you as it is, but it gets you going.

            Peter

            flow (app.activeDocument)

            function flow (doc)
            {
            var m = doc.pages[0].marginPreferences;
            var gbounds = [m.top, m.left,
            doc.documentPreferences.pageHeight - m.bottom,
            doc.documentPreferences.pageWidth - m.right];
            doc.viewPreferences.rulerOrigin = RulerOrigin.pageOrigin;
            while (doc.pages[-1].textFrames[0].overflows)
            {
            var tf = doc.pages.add().textFrames.add ({geometricBounds: gbounds});
            tf.previousTextFrame = doc.pages[-2].textFrames[0];
            }
            }
            • 3. Re: Problems with tables, pages and autoflow
              Level 1
              YuppY!!
              Thank you very much Peter...
              Even if I can't yet obtain all that I want to I was successful in flowing one table, I think this may be a nice start...
              Now I'll try to iterate this thing..
              Thanks!!
              (I'll ask for help if my attempts won't give results)
              Bye
              • 4. Re: Problems with tables, pages and autoflow
                subhaoviya Level 1
                thanks peter it helps for my request also
                • 5. Re: Problems with tables, pages and autoflow
                  rajeshselvaraju Level 1

                  Hi everybody ,

                   

                  We used the flow function to keep adding pages and text frames when text frame overflows. This is working fine in InDesign CS3. But it is not working as expected in InDesign CS4 Server.  We have done the basic things like avoiding the usage of active document to eliminate the user interface. Could you please help us if anybody having the script for autoflowing the text in InDesign Server.

                   

                  Thanks in advance,

                  rajeshselvaraju