Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Given: a .doc(x) file with custom formatting styles applied to some text (example).

Get: a .doc(x) file which is formatted as the given file but does not define any custom styles (example).

I tried converting to .rtf, but unfortunately it saves information about styles.

"Clear formatting" command clears formatting (resets to default), but I need to save it. Removing the style does the same thing (example). This is not what I want.

I just need to remove custom styles, but preserve formatting.

share|improve this question

migrated from Oct 27 '11 at 12:55

This question came from our site for professional and enthusiast programmers.

Do you mean to do this in code, or via the Word UI? If the former, what is your preferred environment? – plutext Mar 5 '11 at 23:10
@plutext, I would appreciate any way of doing this. I prefer Python, though. – utapyngo Oct 20 '11 at 5:09
Down-voting people that didn't give you the answer you wanted will not make you popular. Answers you didn't like can still serve others who find this question by googling. You should thank whoever makes an effort on your behalf, even if it doesn't help. – harrymc Nov 3 '11 at 8:43
up vote 1 down vote accepted

If you have access to Microsoft Excel:

  1. Select all in the Word doc
  2. Paste into Excel (which supports the formatting but not the styles)
  3. While the contents are still selected in Excel (after pasting), immediately copy
  4. Paste back into a new Word doc

I tested this with both your docs using Word and Excel 2010; it preserves the formatting but gets rid of the custom styles.

EDIT: for the more complex examples posted, do the same as above, but use WordPad instead of Excel. I.e. copy all in Word, paste into WordPad, then select-all in WordPad and paste back into a new document. This succeeds (in my test) for everything except the footer, which of course you could do separately (copy, paste out, then copy / paste back into the new document's footer).

share|improve this answer
Hey, I got a table! Your solution seems to work only for one-line documents. For more or less complex documents I get horrible results. I will update the example files. – utapyngo Nov 1 '11 at 2:14
Edited my answer to include a solution that handles the table too. – Geoff Nov 3 '11 at 13:30

Try the following (untested):

Sub DeleteUsedStyles()
    For Each sty In ActiveDocument.Styles
        If sty.InUse Then
        End If
    Next sty
End Sub
share|improve this answer
If you delete a style, don't you lose formatting of the text to which a style was applied? – utapyngo Mar 17 '11 at 10:31
This definitely does not work - I use this technique as a simple way to remove all formatting from a document. Deleting a style reverts the text that was formatted with that style to whatever the default formatting was. – Will M Oct 27 '11 at 13:49
@Will: OK. Would defining a bare style and assigning that work, then? – Charles Stewart Oct 27 '11 at 18:44
Don't think so, but don't know. – Will M Oct 29 '11 at 3:41

Copy and paste into notepad, then copy and paste into a new word doc. That has always worked for me in similar situations, especially with copying and pasting between outlook emails in HTML format.

Word also have the "Paste Special" option with a selection for unformatted text, but that isn't always available in all contexts.

share|improve this answer
I don't want to get rid of formatting. I want make all text tied to Normal style with added formatting. – utapyngo Mar 17 '11 at 10:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .