Tapatalk

Insert Page Break

Insert Page Break

3
NewbieNewbie
3

    Jun 22, 2007#1

    I have a situation that Have no idea how to get started on it. The reports that we print are printed in Landscape. Sometimes the text per page exceed the 45 lines so the text rolls over to the next page. Well this throws off the rest of the report. The only common piece of text is the word Page#. I'd like to search for that text when it's found move up one line and insert a page break. Hopfully this will fource a new page to be created. Can this be done? :?:

    6,685587
    Grand MasterGrand Master
    6,685587

      Jun 23, 2007#2

      If you press the button Help on any Find/Replace dialog you will see a small table with special characters. One of the lines is:

      ^b matches a page break

      The rest is simple:

      InsertMode
      ColumnModeOff
      HexOff
      UnixReOff
      Top
      Find MatchCase RegExp "%^([~^b]*Page[ ^t]++[0-9]^)"
      Replace All "^b^1"

      Add UnixReOn or PerlReOn (v12+ of UE) at the end of the macro if you do not use UltraEdit style regular expressions by default - see search configuration. Macro command UnixReOff sets the regular expression option to UltraEdit style.

      The regular expression search string is probably more complex as necessary for your file, but I don't know the format of the line which contains the page number.
      Best regards from an UC/UE/UES for Windows user from Austria

      3
      NewbieNewbie
      3

        Jun 26, 2007#3

        Very cool. That's almost perfect. It inserts a page break at the ver top that prints out a blank sheet. So I'm going to see if I can figure out how to work around that before I ask the forum.

        Thanks agains

          Jun 26, 2007#4

          I need to find the text "Page#" move up one line insert a page break then find the next string "Page#". The problems I run into so far is if you find the text move up one line it will find the same line of text and put inself in to and endless loop. If you put Find "Page#" twice it works until it gets to the end of the file then goes in to an endless loop. To make it even funner after I insert the page breaks I need to find "Page#" [0-9]+ and replace it with "". Here is what I have for code.

          InsertMode
          ColumnModeOff
          HexOff
          UnixReOff
          Top
          Find "Page#"
          Key UP ARROW
          InsertPageBreak
          Find RegExp "Page# [0-9]+"
          Replace All ""

          Here is a sample of the first page of the report header.

          Code: Select all

          1)
          2)06/08/2007              WY PRA-YELL 103(1)                            Page# 1     
          3)                           North Rim and Canyon Area Roads
          4)                              Grandview Parking Area
          5)                             SLOPE STAKE REPORT (m )
          The number in front of the ) are not in the report I'm just showing the line numbers.

          Thanks

          6,685587
          Grand MasterGrand Master
          6,685587

            Jun 29, 2007#5

            I don't know why you make it so complicated. Look on following macro:

            InsertMode
            ColumnModeOff
            HexOff
            UnixReOff
            Top
            Find MatchCase RegExp " Page# ++[0-9]+"
            Replace ""
            Find MatchCase RegExp "%^([~^b]*^) Page# ++[0-9]+"
            Replace All "^b^1"
            Find MatchCase RegExp " Page# ++[0-9]+"
            Replace All ""

            The macro first searches from top of the current file for the first page number and simply deletes it without inserting a page break because you surely do not want an empty page at start of the file.

            The second search and replace is a replace ALL. It inserts the page break at start of the line with the page number (= after end of the line above) and at the same time deletes the page number.

            Execute this macro once and the job should be done.

            [~^b] makes sure not to insert a page break when there is already one. The last replace all deletes only the page number for those lines where a page break already existed. If your file never contains a page break before macro execution, you can also use the following macro:

            InsertMode
            ColumnModeOff
            HexOff
            UnixReOff
            Top
            Find MatchCase RegExp " Page# ++[0-9]+"
            Replace ""
            Find MatchCase RegExp "%^(*^) Page# ++[0-9]+"
            Replace All "^b^1"
            Best regards from an UC/UE/UES for Windows user from Austria