Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / March 2008

Tip: Looking for answers? Try searching our database.

Find, move down two lines, insert page break

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Allison - 19 Mar 2008 18:38 GMT
Word 2003, Windows XP SP2

Hi all,

I posted this in word.domanagement before I found this programming group.  
It should probably be posted here.

I have a text document with hundreds of pages.  I need to go through and
make sure that each new area begins a new page.

Each new area begins two lines after a row of hyphens.  The row following
the row of hyphens varies, so I can't simply replace that row with the data
followed by a page break.

Any suggestions how to do this automatically or programmatically?

Sample of data:

end of prior section
------------- (entire row of hyphens)
more text here that varies
begin new section here

Thanks for your help.
Klaus Linke - 19 Mar 2008 20:04 GMT
Hi Allison,

It's not too difficult using a wildcard replacement:

With wildcards it's pretty easy too...

Check "Match wildcards",
Find what: -{3,}^13([!13]@^13)
Replace with: \1^m

-{3;} matches 3 or more hyphens, ^13 a paragraph mark, [!^13] any character
*but* a paragraph mark, and [!^13]@ any number of such aforementioned
characters.
(In some language versions, you have to use {3;} ... depending on whether
the field delimiter in your language is a comma or a semicolon.

Put together, -{3,}^13 matches a lot of hyphens hyphens followed by a
paragraph mark, ([!13]@^13) any paragraph.

Since I've put (brackets) around the latter expression, I can re-use the
matched text in the replacement, using \1 ... and ^m is a manual page break.

Regards,
Klaus

> Word 2003, Windows XP SP2
>
[quoted text clipped - 21 lines]
>
> Thanks for your help.
Klaus Linke - 19 Mar 2008 20:11 GMT
> It's not too difficult using a wildcard replacement:
>
> With wildcards it's pretty easy too...

Did I mention it's simple? And that I don't proofread my posts before I hit
"Send"?

;-)  Klaus

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.