Results 1 to 4 of 4
  1. #1
    Star Lounger
    Join Date
    Dec 2009
    Location
    Toronto
    Posts
    81
    Thanks
    6
    Thanked 2 Times in 2 Posts

    changing the format of all lines that begin with a given string

    After reading a book on my Kindle and keeping a lot of "notes" on it--in effect, saving passages as text on the Kindle--I've pasted them into Word.But the format is distracting. A single note looks like this:
    ============
    Title of Book (author's name)
    - Highlight Loc. 88 | Added on Tuesday, February 12, 2013, 03:27 AM

    the former heralding a new golden age of access and participation and the latter bemoaning a new dark age of mediocrity and narcissism.


    I have 38 pages of these notes in Word, which I want to print out, but the first three lines contain so much extraneous information that focusing on the quotations, as I want to do, is difficult. Of course, since the series of equal signs and the title and author are the same for each entry, removing the first two lines is easy using Word's Replace feature. The harder part is the third line, which begins '- Highlight Loc ....' What I'd like to be able to do is reformat that entire line for each entry to a much smaller font. I've started doing it manually using the Paste Format feature, but it's very tedious.

    Is there some way to tell Word to find a string such as '- Highlight' and reformat everything after it to the end of the line? Or is there another program that might do it?
    Last edited by DavidToronto; 2013-02-20 at 16:10.

  2. #2
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    Willow Grove, Pennsylvania, USA
    Posts
    196
    Thanks
    4
    Thanked 46 Times in 38 Posts
    Yes, there is a way.

    First, you need to know what character appears at the end of the line you want to change. Press Ctrl+Shift+8 to display nonprinting characters. If the line ends with a left-pointing arrow (which is what I see when I paste your sample into Word), use the code ^11 in the instructions below; if it ends with the paragraph mark ¶ then use the code ^13 instead.

    Open the Replace dialog, click the More button, and check the box for "Use wildcards".

    In the Find What box, paste (using Ctrl+V) the following expression:

    - Highlight [!^11]@^11

    (Again, if your line ends with ¶, then replace both of the ^11 codes with ^13.)

    In the Replace With box, enter the code

    ^&

    and then click the Format button at the bottom of the dialog, click Font, and choose the font size you want.

    Finally, click Replace All.

    For more information about wildcard find/replace, read http://www.gmayor.com/replace_using_wildcards.htm.

  3. #3
    2 Star Lounger
    Join Date
    Dec 2009
    Location
    Canada
    Posts
    120
    Thanks
    3
    Thanked 20 Times in 18 Posts
    The above method will work, but may be more complicated than you need.

    I would recommend applying a paragraph style to the found text:

    Find what: - Highlight Loc.
    Replace with: ^&
    Format: Style: Heading 4

    To get the format, click the Format button and choose the Style... pulldown option. I chose Heading 4 here, but any paragraph style (i.e. marked with ¶ only) could be used. The replace will keep the found what text (via the ^& code) but apply the style.

    You can then modify the style definition to display with whatever formatting you want (including making it invisible by using hidden text if you choose).

  4. #4
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    3,945
    Thanks
    0
    Thanked 203 Times in 184 Posts
    Quote Originally Posted by jjfreedman View Post
    First, you need to know what character appears at the end of the line you want to change. Press Ctrl+Shift+8 to display nonprinting characters. If the line ends with a left-pointing arrow (which is what I see when I paste your sample into Word), use the code ^11 in the instructions below; if it ends with the paragraph mark ¶ then use the code ^13 instead.
    Actually, you don't really need to know which. You could use:
    Find = - Highlight [!^13^11]{1,}[^13^11]

    I'm inclined to agree with Eric that using a Style to define the replacement is the better way to go (though not necessarily the Heading 4 paragraph Style) but, as posted, his approach will give undesirable results if the found text ends with a manual line break that carries the paragraph over to content you don't want to reformat (using a character Style for the replacement wouldn't have this effect). For use with a paragraph Style, a better set of Find/replace expressions would be:
    Find = (- Highlight [!^13^11]{1,})[^13^11]
    Replace = \1^p
    Cheers,

    Paul Edstein
    [MS MVP - Word]

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •