![]() |
|
![]() |
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
![]()
I am using the (wildcards enabled) regular expression ([0-9]{1,})^p to find chapter headings (which are just numbers followed by a carriage return) and replace them with ^m\1^p^p^p and the style Heading 1. The result I am getting is that Heading 1 is improperly applied (I modified Heading 1 to centered, but it is justified in the instances where find/replace makes the changes but centered elsewhere) but also bleeds into the next paragraph. I end up with the page break, and the mis-styled chapter heading, the three returns AND the entire next paragraph styled as Heading 1.
I guess maybe the reason the chapter heading is justified is because it is picking that attribute up from the following paragraph? But how can I keep find/replace from trying to incorporate the two? Thanks in advance. Sorry if it's already been asked or it's dumb but I'm new to regex and the results I am getting are hard to search for. I'm using Microsoft Word 2007 on win7-64 in case that's relevant. |
#2
|
||||
|
||||
![]()
The F/R is behaving that way because you've specified a Style name for the Find/Replace. Anything replaced that way adopts the same Style. The use of wildcards has nothing to do with that one way or the other. In any event, instead of inserting two extra paragraph breaks after the Heading, what you should do is change the Heading 1 Style's definition so that it includes an appropriate 'space after' value (e.g. 24pt). If you want to avoid the page breaks adopting the Heading 1 Style, do the Find/Replace in two steps: first insert the page breaks; then apply the Style, viz.:
Find = [0-9]{1,}^13 Replace = ^m^& Replace = ^& with the second one specifying Heading 1 for the Style.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
![]() Quote:
Alright, thanks for the tip. After I had to frame the question to post that it occurred to me that it might be best done in two steps and you seem to confirm that. I will try your suggestion of modifying the Style next time this comes up. Cheers |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to use find and replace to change text to a custom style | wrdy | Word | 7 | 03-11-2014 12:09 AM |
![]() |
paulkaye | Word | 4 | 12-06-2011 11:05 PM |
Find bullets and replace with paragraph style? | cdybdahl | Word | 1 | 12-02-2011 02:14 AM |
Find and replace multiple documents change style | BaPW | Word | 0 | 08-14-2011 11:12 AM |
Character style stripped while applying paragraph style | sams_gates | Word | 0 | 08-29-2009 02:03 AM |