7 Replies Latest reply on Oct 8, 2013 9:09 AM by Dan-BTP

    Place file with autoflow

    Dan-BTP Level 1

      I want to place a set of RTF files in a new document (created within my VB.NET program) with the following statement, so the text from each file follows the previous text in one connected text flow:

       

      CType(BodyFrame.ParentStory.InsertionPoints.Item(-1), InDesign.InsertionPoint).Place(ImportFilePath)

       

      How do I get it to autoflow the text? Right now it stops at the bottom of the text frame on the first page (the only page defined in the document) and gives the red box for overset text in the lower right corner of the text frame.

       

      If I use the page place method, there's an optional parameter to specify autoflow text, but the text frame place method doesn't have this optional parameter.

       

      Thanks!

        • 1. Re: Place file with autoflow
          BEGINNER_X Level 3

          Hi Dan,

           

          I do not know the VB.net.

           

          But this concept helps you,

           

          Go to Preferences ----- Type ------ Smart Text Reflow -------- End of Document

           

           

          Please find screenshot:

           

          smart text reflow.png

          Thanks

          Beginner_X

          • 2. Re: Place file with autoflow
            Dan-BTP Level 1

            Thank you for your response. I have turned on Smart Text Reflow (it is set to True in my program, and I can see it checked in InDesign when I open the document), but it does not automatically flow to additional pages when I place the file.

             

            The same thing is true of Delete Empty Pages. Even though it is checked, if I have more pages in the document than are needed so several pages at the end are empty (each contains a text frame without any text in it), the empty pages are not deleted when the document is opened.

             

            How do I get the automatic flowing to as many pages as are needed and the deletion of empty pages automatically?

            • 3. Re: Place file with autoflow
              AnshulJain19 Adobe Employee

              Hi Dan,

               

              By default, Smart Text Reflow is limited to primary text frames.

              You can change settings to allow pages to be added or removed when working in text frames that aren’t Primary text frames by unchecking option 'Limit To Primary Text Frames'. However, a text frame must be threaded to at least one other text frame on a different page for Smart Text Reflow to work.

              Similar is true for Delete Empty Pages.

              You can set Smart Text Reflow through script using following property

              TextPreference.smartTextReflow

               

              Thanks

              -Anshul

              1 person found this helpful
              • 4. Re: Place file with autoflow
                Dan-BTP Level 1

                Anshul,

                 

                Thank you for your response! That's very helpful.

                 

                I'm trying to set the PrimaryTextFrame property in my VB.NET program. I have a simple document with one master spread A with left and right pages. On each of those pages I define a new text frame. I'm trying to set the master spread's PrimaryTextFrame property to the text frame on the left page, but I'm getting an error: "Invalid object for this request."

                 

                How do I set the PrimaryTextFrame in a script or using the type library?

                 

                Thanks!

                 

                Dan

                • 5. Re: Place file with autoflow
                  Dan-BTP Level 1

                  Anshul,

                   

                  I don't know if it helps in getting a solution to my problem, but I have recreated the same scenario in a JSX script:

                   

                  for (var i = 0; i < doc.masterSpreads.length; i++) {   

                      for (var j = 0; j < doc.masterSpreads[i].pages.length; j++) {

                          with (doc.masterSpreads[i].pages[j]) {

                              var curFrame = textFrames.add();

                                                     

                              if (j == 0) {

                                  doc.masterSpreads[i].primaryTextFrame = curFrame;

                                  }

                              }

                          }

                      }

                   

                  On the line that contains primaryTextFrame, I get the same error: Invalid object for this request.

                  • 6. Re: Place file with autoflow
                    AnshulJain19 Adobe Employee

                    Hi Dan,

                     

                    I am also not able to set primaryTextFrame proeprty of master spread, this seems like a bug.

                    But for your workflow you may chose some workarounds like either set application's primary text frame property as true so that new documents will have primary text frame in it.

                    app.documentPreferences.createPrimaryTextFrame  = true


                    Other is if you do not specifically want smart text reflow to work only with primary text frame then you can turn it on for normal text frames by unchecking 'Limit To Primary Text Frames'.

                    app.activeDocument.textPreferences.limitToMasterTextFrames = false


                    Thanks

                    -Anshul

                    • 7. Re: Place file with autoflow
                      Dan-BTP Level 1

                      Anshul,

                       

                      Thanks again for your helpful response!

                       

                      I agree that it appears to be a bug. The only way I can get it to work (either through scripting with JavaScript or in my VB.NET program using the CS6 type library) is by setting the application document preferences for createPrimaryTextFrame to true. For now, that's the way I'll have to go in order to proceed with my development.

                       

                      Thanks again for your help!

                       

                      Dan