3 Replies Latest reply on Jan 6, 2010 3:21 AM by [Jongware]

    Detecting Page Break before/after text

    PinalV

      Is there a way to detect if there is a page break before or after a block of text through scripting?

        • 1. Re: Detecting Page Break before/after text
          Roy McCoy Level 1

          I don't think it's clear what you mean. What kind of page break? What 

          kind of block of text?

           

          Roy McCoy

          • 2. Re: Detecting Page Break before/after text
            PinalV Level 1

            As far as i know there is only one page break. Block of text is a "TextStyleRange" or a "Paragraph"

            • 3. Re: Detecting Page Break before/after text
              [Jongware] Most Valuable Participant

              yourSelection.characters.item(-1).contents

               

              This will return a regular single character "\r" for a hard return at the end, but any of ID's breaks will be indicated by one of the values:

               

              SpecialCharacters.COLUMN_BREAK

              SpecialCharacters.EVEN_PAGE_BREAK

              SpecialCharacters.FRAME_BREAK

              SpecialCharacters.ODD_PAGE_BREAK

              SpecialCharacters.PAGE_BREAK

               

              (as you can see there is more than one 'break' character).

               

              To check a page break before the current paragraph, you will have get a pointer the paragraph before the current one and do this same check on that.

               

              Check also the constant

               

              yourSelection.startParagraph

               

              which can be

               

              StartParagraph.NEXT_COLUMN
              StartParagraph.NEXT_EVEN_PAGE
              StartParagraph.NEXT_FRAME
              StartParagraph.NEXT_ODD_PAGE
              StartParagraph.NEXT_PAGE

              indicating the Keep Options applied to the current paragraph. These also make paragraphs start at a new page.

               

              Finally, there is the possibility that none of the above applies, but the previous paragraph ended right at the bottom of a text frame, and the current paragraph starts at the top of a new frame. No special character or code, but still a page break. (Perhaps you could test paragraph.lines for that.)