2 Replies Latest reply on Dec 23, 2009 6:25 AM by mkseva

    How to make autoflow text?

    mkseva

      Hello everyone.

       


      I wrote a program to automate the typesetting in C #. (but would be happy to suit in any other language).

       

      My script (program) generates a text file (format taggedtext) for insertion into InDesign.
      The program opens the file ready InDesign which has two columns. I paste text into a text frame.
      Here is an example code:

       

      ....

       

      Type inDesignAppType = Type.GetTypeFromProgID("InDesign.Application.CS3");

       


      InDesign.Application myInDesign = (InDesign.Application)Activator.CreateInstance(inDesignAppType);

       

      InDesign.Document doc = null;

       

      try {

       

                myInDesign.Open(pathToFile, true);
                doc = myInDesign.ActiveDocument;
                InDesign.Page page = (InDesign.Page)doc.Pages[1];
                InDesign.TextFrame tf = doc.TextFrames.Add(doc.Layers[1], idLocationOptions.idUnknown, doc);
                tf.GeometricBounds = new string[4] { "26mm", "10mm", "229.4mm", "94.95mm" };
                tf.Place(pathToTextFileName, false);

       

      }

       

      .....

       

      Is it possible to make the text to be automatically stretched to the following columns and pages?

       

      Thanks a lot.

        • 1. Re: How to make autoflow text?
          Peter Kahrel Adobe Community Professional & MVP

          Add a new text frame, thread it to tf (tf.nextTextFrame = new textframe).

          While the new textframe overflows, keep adding and threading frames.

           

          In CS4 you can make use of "Smart Text Reflow", which can save you some trouble.

           

          Peter

          • 2. Re: How to make autoflow text?
            mkseva Level 1

            Thanks a lot Peter.

             

            The result code is:

            ...

            try{

                 string[][] myTemplateGeometricBounds = { new string[4] { "26mm", "10mm", "229.4mm", "94.95mm" }, new string[4] { "26mm", "100.95mm", "229.4mm", "185.9mm" } };
                 myInDesign.Open(pathToFile, true);
                 doc = myInDesign.ActiveDocument;
                 InDesign.Page page = (InDesign.Page)doc.Pages[1];
                 InDesign.TextFrame tf = doc.TextFrames.Add(doc.Layers[1], idLocationOptions.idUnknown, doc);
                 tf.GeometricBounds = myTemplateGeometricBounds[0];
                 tf.Place(pathToTxtFileName, false);
                 int columnNum = 1;
                 if (tf.Overflows)
                 {
                      do
                      {
                           if (columnNum == 0)
                           {
                                page = doc.Pages.Add(idLocationOptions.idAfter, page);
                           }
                           InDesign.TextFrame tfAfter = page.TextFrames.Add(doc.Layers[1], idLocationOptions.idUnknown, doc);
                           tf.NextTextFrame = tfAfter;
                           tfAfter.GeometricBounds = myTemplateGeometricBounds[columnNum];
                           tf = tfAfter;
                           columnNum = columnNum == 1 ? 0 : 1;
                      }
                      while (tf.Overflows);
                  }

            }

            catch{

            ...

            }

            ...