Find/Replace causes whole paragraph style to change

jmt356
SilverLounger
Posts: 2389
Joined: 28 Mar 2010, 01:49

Find/Replace causes whole paragraph style to change

Post by jmt356 »

I'm trying make every number in my document appear in superscripts. To do this, I create a new style called "Superscripts" and applied superscripts to the style. I thought I could then go through the document and find and replace each number in the normal or body text style with the same number in the superscripts style.

However, when using the find/replace to find numbers and replace them with the same number but with the Superscript style applied, everything in the paragraph takes on the new style when I apply the new style to the number in the Find/Replace box. Is there a way to program the Find/Replace box such that it only replaces the number with the new style without applying the new style to the rest of the paragraph?

In case it's not possible to limit the application of the new style, can anyone suggest a macro that can apply a new style to only the numbers in each paragraph so that the text stays in Norma/Body Text style?
Regards,

JMT

User avatar
HansV
Administrator
Posts: 78485
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Find/Replace causes whole paragraph style to change

Post by HansV »

You have to specify a character style. If you specify a paragraph style, it'll apply to the entire paragraph.
Best wishes,
Hans

jmt356
SilverLounger
Posts: 2389
Joined: 28 Mar 2010, 01:49

Re: Find/Replace causes whole paragraph style to change

Post by jmt356 »

Thanks Hans. That explains it.

But why is it now that I have a new character style, when I select a paragraph that has two styles in it--Body Text and Superscript, and press ctrl + spacebar (in order to restore the default formatting for each style), Superscript becomes Body Text?
Regards,

JMT

User avatar
HansV
Administrator
Posts: 78485
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Find/Replace causes whole paragraph style to change

Post by HansV »

Ctrl+spacebar reapplies the paragraph style and removes character styles.
Best wishes,
Hans

jmt356
SilverLounger
Posts: 2389
Joined: 28 Mar 2010, 01:49

Re: Find/Replace causes whole paragraph style to change

Post by jmt356 »

Creating Superscript as a character style and not a paragraph style worked for applying it only to the numbers selected in Find/Replace in an English document I am using. But in an Arabic document I am using, it is either applying to the character style to the adjacent text (for example, if I select "18" in the phrase "18كلمة", then both 18 and كلمة become Superscript style, or, alternatively, the entire paragraph. I am not sure what I am doing to cause this ... the style I am using, Superscript-AR, had the same properties as Superscript in the English document. The only difference between Superscript-AR (which I'm using in the Arabic document) and Superscript (which I'm using in the Enlgish document) is that the former includes raising the position of the text by 3 pts.
Last edited by jmt356 on 17 Feb 2011, 16:59, edited 1 time in total.
Regards,

JMT

User avatar
HansV
Administrator
Posts: 78485
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Find/Replace causes whole paragraph style to change

Post by HansV »

I'm sorry, I have no idea how non-western scripts are handled in Word.
Best wishes,
Hans

jmt356
SilverLounger
Posts: 2389
Joined: 28 Mar 2010, 01:49

Re: Find/Replace causes whole paragraph style to change

Post by jmt356 »

Actually, I'm finding that the behavior is only happening to the text right adjacent to the number where the cursor is standing when I modify the character style, not to every word adjacent to every appearance of the number in the document, which makes it much more manageable to go back and correct.
Regards,

JMT

jmt356
SilverLounger
Posts: 2389
Joined: 28 Mar 2010, 01:49

Re: Find/Replace causes whole paragraph style to change

Post by jmt356 »

HansV wrote:Ctrl+spacebar reapplies the paragraph style and removes character styles.
Hans, my understanding is that ctrl + spacebar only removes character styles, but it doesn't reapply the paragraph style. Isn't the paragraph style the style that controls things such as indentation, left and right alignment, and spacing before and after a paragraph? If so, then it is not ctrl + spacebar that reapplies the paragraph style but rather ctrl + Q. Ctrl + spacebar only removes the character/font formatting such as italics, font size, and character spaceing. But if I add a 20 pt space before a paragraph, and that paragraph's style has 0 pt space before, then ctrl + spacebar won't reapply the 0 pt space inherent in the paragraph style. Ctrl + Q will.
Regards,

JMT

User avatar
HansV
Administrator
Posts: 78485
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Find/Replace causes whole paragraph style to change

Post by HansV »

OK, it reapplies the character (font) properties of the paragraph style.
Best wishes,
Hans

User avatar
Sundog
5StarLounger
Posts: 704
Joined: 28 Jan 2010, 22:47
Location: Alien Country (Roswell NM)

Re: Find/Replace causes whole paragraph style to change

Post by Sundog »

In Word 2007, my inherited 250-endnote document has some endnotes styled as Endnote Text when I include the paragraph mark, some endnote paragraphs are styled data_bold when I include the paragraph mark, and some endnote paragraphs show as Endnote Text at the paragraph level but contain characters styled as data_bold. How can I convert the font-level style scattered through my endnotes to be the paragraph-level style?
Sundog

User avatar
HansV
Administrator
Posts: 78485
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Find/Replace causes whole paragraph style to change

Post by HansV »

You could run a macro:

Code: Select all

Sub EndnotesStyle()
  Dim en As Endnote
  For Each en In ActiveDocument.Endnotes
    en.Range.Style = ActiveDocument.Styles("data_bold")
  Next en
End Sub
Best wishes,
Hans

User avatar
Sundog
5StarLounger
Posts: 704
Joined: 28 Jan 2010, 22:47
Location: Alien Country (Roswell NM)

Re: Find/Replace causes whole paragraph style to change

Post by Sundog »

Excellent. Will try. Thanks.
Sundog