locked
Why Word interprets sometimes <w:cr> as paragraph mark, not carriage return RRS feed

  • Question

  • There are some documents (mostly in DOC format), which are misinterpreted in Word 2007 and 2010. When document is opened, there are many paragraphs as expected, but some paragraph marks are just characters. The behavior of these marks can be described like this:

    • cursor can be set after this mark (using End key)
    • when searching paragraph mark (using "^p") - these paragraphs are not found
    • when moving to next paragraph using keyboard (Ctrl+down key) - these false paragraphs are skipped
    • you can search these marks by searching "^13" - which finds right paragraph marks and also these false marks

    When looked at WordprocessingXML I've found that there is <w:cr /> (i.e. mark for carriage return), but it's not interpreted like carriage return ("^l", or "^11"), but like mark with decimal value 13.

    I can send document with described issue.

    Is this bug in Word?


    Boris Lehečka (Word, Access, VBA, XML, C#, SQL)
    Sunday, August 21, 2011 4:40 PM

Answers

  • Hi Boris

    This is more likely a problem with the text from which these documents were created. If the user copies/pastes text that contains what Word considers non-standard paragraph marks, or the user inserts a file with non-standard paragraph marks, or code builds a file with non-standard paragraph marks, this has been known to happen.

    So it's not a bug in Word but a mistake in text that was brought into Word from an outside source.

    Usually, the way to clean these up is to figure out what character value they have then use Find/Replace to replace them with ^p

    If for example you've determined that the character code is ANSI 10 the search text would be: "^0010"


    Cindy Meister, VSTO/Word MVP
    • Marked as answer by Bruce Song Thursday, September 1, 2011 8:03 AM
    Sunday, August 21, 2011 5:23 PM
  • Strictly speaking, there is a bug in Word because the standard for Word 97-2003-format (.doc) documents says that the CR (ascii 13) character can not appear except as a paragraph mark placeholder. I'm not absolutely sure about the Word 2007- and 2010-format (.docx and ..docm) standards but as they seem to include specific markup, this may be allowed now.
     
    Depending on what you want as an end result, the easiest way to 'correct' things is to do a global Find and Replace, replacing all ^13 characters with ^p characters.
     
     

    Enjoy,
    Tony
    www.WordArticles.com
    • Marked as answer by Bruce Song Thursday, September 1, 2011 8:03 AM
    Monday, August 22, 2011 12:14 PM

All replies

  • Hi Boris

    This is more likely a problem with the text from which these documents were created. If the user copies/pastes text that contains what Word considers non-standard paragraph marks, or the user inserts a file with non-standard paragraph marks, or code builds a file with non-standard paragraph marks, this has been known to happen.

    So it's not a bug in Word but a mistake in text that was brought into Word from an outside source.

    Usually, the way to clean these up is to figure out what character value they have then use Find/Replace to replace them with ^p

    If for example you've determined that the character code is ANSI 10 the search text would be: "^0010"


    Cindy Meister, VSTO/Word MVP
    • Marked as answer by Bruce Song Thursday, September 1, 2011 8:03 AM
    Sunday, August 21, 2011 5:23 PM
  • Strictly speaking, there is a bug in Word because the standard for Word 97-2003-format (.doc) documents says that the CR (ascii 13) character can not appear except as a paragraph mark placeholder. I'm not absolutely sure about the Word 2007- and 2010-format (.docx and ..docm) standards but as they seem to include specific markup, this may be allowed now.
     
    Depending on what you want as an end result, the easiest way to 'correct' things is to do a global Find and Replace, replacing all ^13 characters with ^p characters.
     
     

    Enjoy,
    Tony
    www.WordArticles.com
    • Marked as answer by Bruce Song Thursday, September 1, 2011 8:03 AM
    Monday, August 22, 2011 12:14 PM
  • Hi Boris ,

    How about the problem on your side? Do the suggestions help you? If you still show any concern on the post, just feel free to let us know.

    Best Regards,


    Bruce Song [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, August 26, 2011 7:59 AM