Microsoft Office Forums

Go Back   Microsoft Office Forums > Microsoft Word > Word

Closed Thread
 
LinkBack Thread Tools Display Modes
  #1  
Old 05-26-2012, 05:43 PM
Cobb78 Cobb78 is offline Windows 7 64bit Office 2010 64bit
Novice
 
Join Date: May 2012
Posts: 10
Cobb78 is on a distinguished road
Default remove styles but keep formatting?

I have 27 documents which need editing. In each of them, there is a style applied to parts throughout the document. It is italicized and red. Because of the conversion I must do to translate it into a database, I need to make all the paragraph breaks into line breaks. The problem is that when I do that, every bit of the text becomes italicized.

Is there a way to replace the paragraph breaks (^p) with line breaks (^l) and not have the formatting automatically change? I still want the original color and italics to stay, but I don't want them to spread to the rest of the document.

I would completely remove the style from each section, but that would cause me to have to go back through the entire document and manually re-italicize each part.

Help?
  #2  
Old 05-27-2012, 05:01 AM
macropod's Avatar
macropod macropod is online now Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 18,680
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

Hi Cobb,

You can achieve that by saving the document as an RTF file, then opening it in WordPad. Make an edit of any kind in WordPad, then re-save the file. When you re-open the file in Word, all the content will then have the 'Normal' Style applied, with direct formatting to create the character effects. You can then delete the paragraph breaks without any character format changes.
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
  #3  
Old 05-27-2012, 06:25 PM
Cobb78 Cobb78 is offline Windows 7 64bit Office 2010 64bit
Novice
 
Join Date: May 2012
Posts: 10
Cobb78 is on a distinguished road
Default

Hot Dog! That just saved me an absolute boatload of time with the rest of my fixes. Thank you so very, very much!
  #4  
Old 05-27-2012, 06:31 PM
Cobb78 Cobb78 is offline Windows 7 64bit Office 2010 64bit
Novice
 
Join Date: May 2012
Posts: 10
Cobb78 is on a distinguished road
Default

well...ok, now that created another problem. All my footnote references are gone. I think I can rearrange my steps to make that irrelevant.
  #5  
Old 05-27-2012, 07:14 PM
macropod's Avatar
macropod macropod is online now Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 18,680
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

That'll be because WordPad doesn't support footnotes ...

What you can do is unlink the footnotes before converting to RTF, using the following macro:
Code:
Sub UnLinkNotes()
Application.ScreenUpdating = False
Dim nRng As Range, fNote As Footnote, nRef As String
With ActiveDocument
  For Each fNote In .Footnotes
    With fNote
      With .Reference.Characters.First
        .InsertAfter "]"
        .Characters.Last.Font.Superscript = True
        .Collapse wdCollapseStart
        .InsertCrossReference wdRefTypeFootnote, wdFootnoteNumberFormatted, fNote.Index
        nRef = .Characters.First.Fields(1).Result
        .Characters.First.Fields(1).Unlink
        .InsertBefore "["
        .Characters.First.Font.Superscript = True
      End With
      .Range.Cut
    End With
    Set nRng = .Range
    With nRng
      .Collapse wdCollapseEnd
      .End = .End - 1
      If .Characters.Last <> Chr(12) Then .InsertAfter vbCr
      .InsertAfter nRef & " "
      With .Paragraphs.Last.Range
        .Style = "Footnote Text"
        .Words.First.Style = "Footnote Reference"
      End With
      .Collapse wdCollapseEnd
      .Paste
      If .Characters.Last = Chr(12) Then .InsertAfter vbCr
    End With
  Next
  For Each fNote In .Footnotes
    fNote.Delete
  Next
End With
Set nRng = Nothing
Application.ScreenUpdating = True
End Sub
Then, when you re-import into Word, select the footnotes (which will now be at the end of the document) and re-link them with the following macro:
Code:
Sub ReLinkFootNotes()
Dim i As Integer, j As Integer, k As Integer, l As Integer, FtRng As Range
Application.ScreenUpdating = False
With ActiveDocument
  Set FtRng = Selection.Range
  With FtRng
    .Style = "Footnote Text"
    With .Find
      .ClearFormatting
      .Replacement.ClearFormatting
      .Text = "\[([0-9]{1,})\]"
      .Replacement.Text = "\1"
      .Forward = True
      .Wrap = wdFindStop
      .Format = False
      .MatchCase = False
      .MatchWholeWord = False
      .MatchAllWordForms = False
      .MatchSoundsLike = False
      .MatchWildcards = True
      .Execute Replace:=wdReplaceAll
    End With
    k = .Paragraphs(1).Range.Words(1) - 1
    j = k
    l = ActiveDocument.Footnotes.Count - k
    For i = 1 To .Paragraphs.Count
      If .Paragraphs(i).Range.Words(1) = j + 1 Then
        j = j + 1
      End If
    Next i
  End With
  For i = k + 1 To j
    StatusBar = "Finding Footnote Location: " & i + l
    With .Content.Find
      .Text = "[" & i & "]"
      .Font.Superscript = True
      .MatchWholeWord = True
      .MatchWildcards = False
      .Execute
      If .Found = True Then
        .Parent.Select
        With Selection
          .Delete
          .Footnotes.Add Range:=Selection.Range, Text:=""
        End With
      End If
    End With
  Next i
  With FtRng
    For i = k + 1 To j
      StatusBar = "Transferring Footnote: " & i + l
      With .Paragraphs(1).Range
        .Cut
        With ActiveDocument.Footnotes(i + l).Range
          .Paste
          .Words(1).Delete
          .Characters.Last.Delete
        End With
      End With
    Next i
  On Error Resume Next
  End With
  Set FtRng = Nothing
End With
Application.ScreenUpdating = True
End Sub
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
  #6  
Old 06-07-2012, 03:48 PM
CharlzNine CharlzNine is offline Windows 7 32bit Office 2010 32bit
Novice
 
Join Date: Jun 2012
Location: Chicago
Posts: 2
CharlzNine is on a distinguished road
Default Update to this solution - use ODT format

When I saved as an RTF, made a change and resaved and RTF, it STILL retained Heading Styles. So I tried ODT and that worked.

Also, there are some Macro Packages out there like Payne, Softwise (now called Innova), Legal MacPac, LegalBar, etc. that have a button that quickly converts all styles to direct formatting.

I *thought* that there was a feature in Word that would strip the styles, just like it can strip other metadata in a document. I looked but can't find it. So without a purchased macro package, I don't think Word has anything to do it natively. Microsoft Fail.
  #7  
Old 06-07-2012, 03:59 PM
macropod's Avatar
macropod macropod is online now Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 18,680
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

Hi CharlzNine,

Your reply suggests you didn't do as the advice given to Cobb78 suggested, which entailed making an edit with WordPad. As for the other macro packages, you're welcome to use them if that's what you prefer.

Your belief that Word could strip all Styles shows a basic lack of understanding of how Word works. Every document must use at least one Style (typically, Normal). The foregoing discussion in this thread shows how it can be done without "a purchased macro package".
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
  #8  
Old 06-07-2012, 04:21 PM
CharlzNine CharlzNine is offline Windows 7 32bit Office 2010 32bit
Novice
 
Join Date: Jun 2012
Location: Chicago
Posts: 2
CharlzNine is on a distinguished road
Default

You are correct, an edit does have to be made. However I did that. For the RTF, it still kept the heading styles. But when I used the ODT format, it all got put to the Normal style. Exactly what we wanted. I didn't have footnotes in my document, but i'm sure the macro will work. I'll test it out tomorrow. To clarify, they should first be converted to end notes, correct?

Not sure if this could be a factor, but I'm using 2010 32 bit.
  #9  
Old 06-07-2012, 04:30 PM
macropod's Avatar
macropod macropod is online now Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 18,680
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

No, you don't need to convert the footnotes to endnotes. If you do so, the code won't work. The first macro does all the processing that is required.
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
  #10  
Old 12-28-2012, 01:19 PM
tonytony tonytony is offline Windows XP Office 2003
Novice
 
Join Date: Dec 2012
Posts: 1
tonytony is on a distinguished road
Thumbs up

My problem was this: I needed to copy one document into another document, the latter containing a TOC. However while I wanted to preserve the formatting, I didn't want to copy over the style information as that was creating unnecessary entries in the TOC.

What I found was that after saving the document as RTF, opening it in Wordpad, making a change and re-saving it as suggested by Macropod, MS Word still retained style information. It seems that Word has a smart way of figuring out which style particular text should use.

So I followed Charlznine's reco and opened the RTF in OpenOffice and copied over the text as desired. Presto!

Thanks to both Macropod and Charlznine for this
  #11  
Old 08-10-2014, 04:36 AM
bijanrf bijanrf is offline Windows 7 64bit Office 2010 64bit
Novice
 
Join Date: Aug 2014
Posts: 1
bijanrf is on a distinguished road
Default You can use format painter

I had this problem and found this forum whilst looking for the answer. I solved it like this:

Format painter will only transfer styles if you select a paragraph marker. If you want to keep the font style but not the paragraph style, select a word in the paragraph and then use format painter on the text taht you want to change (without changing the style).
  #12  
Old 08-10-2014, 04:40 AM
macropod's Avatar
macropod macropod is online now Windows 7 32bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 18,680
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

Hi bijanrf,

That's not much use if you need to replicate paragraph formats as well.

PS: Please don't resurrect old threads - this one was last active nearly two years ago.
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
  #13  
Old 10-05-2018, 08:18 AM
jdavidstark jdavidstark is offline Windows 10 Office 2016
Novice
 
Join Date: Oct 2018
Posts: 3
jdavidstark is on a distinguished road
Default Error in ReLinkFootNotes()

When I run ReLinkFootNotes(), I get an error on this line:

k = .Paragraphs(1).Range.Words(1) - 1

That says "Type mismatch." Would you have any recommendations how to resolve this issue?

The unlinking macro ran perfectly.

Thank you so much!
  #14  
Old 10-05-2018, 02:36 PM
macropod's Avatar
macropod macropod is online now Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 18,680
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

As advised in my previous reply:
Quote:
Please don't resurrect old threads - this one was last active nearly two years ago.
And that was four years ago. Thread closed.
Kindly start a new thread, referencing this one, and explaining exactly what you've done.
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Closed Thread

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hyperlink formatting/styles reset when replying ennuipreneur Outlook 2 05-29-2012 08:56 AM
Strange formatting - unable to remove. Kaem Word 3 03-01-2012 09:31 AM
Is it possible to link images to formatting styles? ChuckR Word 3 01-26-2012 11:52 AM
Formatting doc with too many unwanted styles faithhealer Word 1 11-30-2011 02:40 PM
I want to remove formatting Rose Word 2 05-30-2010 04:12 AM


All times are GMT -7. The time now is 01:00 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
MSOfficeForums.com is not affiliated with Microsoft