none
StyleRef field will not include hard space ASCW(8194) RRS feed

  • Question

  • In Word 2003 StyleRef fields referencing text that contained a hard space ( <ctrl><space> )  ascw(8194) worked fine.  In 2010 get a reference to all but the hard space.  Replacing the hard space with a non breaking space ( <ctrl><shift><space> ), ascw(160) works.  Any ideas on why Word 2010 treats the hard space differently in a field reference?

    Ken

    -- looking into this a bit more... Found that all symbols that I inserted into the referenced text (from insert - symbol) come through to the referenced field except en and em spaces.
    • Edited by kbax Tuesday, October 23, 2012 8:53 PM
    Tuesday, October 23, 2012 4:28 PM

Answers

  • HI kbax,

    Thanks for posting in the MSDN Forum.

    Would you please try chrW(8194)?

    Have a good day,

    Tom


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us

    Wednesday, October 24, 2012 6:59 AM
    Moderator
  • Before you go too far along this route, do your 8194 characters in the STYLEREF fields survive when you save, close, re-open and re-execute the STYLEREF? They don't here if I save in .docx format, but they do if I save as .doc or WOrd 2003 XML format.

    In the XML, what tends to happen is that the text (let's say it is "abc[the 8194 character]def") is divided up into three "runs" containing text elements which contain

    abc

    [the 8194 character] encoded in UTF8 format (hex e2 80 82)

    def

    At its simplest this is encoded as 

    <w:r><w:t>abc</w:t></w:r><w:r><w:t>[the 8194 character encoded as above]</w:t></w:r><w:r><w:t>def</w:t></w:r>

    (the 8194 character may be encoded in different ways, but AFAICS the results are the same)

    If, however, you modify the XML so that you have

    <w:r><w:t>abc[the 8194 character encoded as above]</w:t></w:r><w:r><w:t>def</w:t></w:r>

    when you re-open, the STYLEREF field still seems to work. What's more, when you save as Word 2003 XML, this is the encoding used.

    So I would suggest that there could be an error in the way that Word's STYLEREF field deals with text runs that contain certain types of character.


    Peter Jamieson

    Thursday, October 25, 2012 2:05 PM

All replies

  • HI kbax,

    Thanks for posting in the MSDN Forum.

    Would you please try chrW(8194)?

    Have a good day,

    Tom


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us

    Wednesday, October 24, 2012 6:59 AM
    Moderator
  • Thank you, insertafter(chrw(8194)) works.  

    Why does that work, when a ctrl space (which tests to be chr 8194 also) does not?  Why do these documents display properly in Word 2003 and not in Word 2010?

    Unfortunately I have many hundreds of these documents that were created in Word 2003 and now need to be changed.

    Ken

    Wednesday, October 24, 2012 3:04 PM
  • Hi kbax,

    I think this topic will help you: http://www.dailydoseofexcel.com/archives/2010/11/19/unicode-and-vbas-chrw-and-ascw-functions/

    Have a good day,

    Tom


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us

    Thursday, October 25, 2012 6:11 AM
    Moderator
  • Before you go too far along this route, do your 8194 characters in the STYLEREF fields survive when you save, close, re-open and re-execute the STYLEREF? They don't here if I save in .docx format, but they do if I save as .doc or WOrd 2003 XML format.

    In the XML, what tends to happen is that the text (let's say it is "abc[the 8194 character]def") is divided up into three "runs" containing text elements which contain

    abc

    [the 8194 character] encoded in UTF8 format (hex e2 80 82)

    def

    At its simplest this is encoded as 

    <w:r><w:t>abc</w:t></w:r><w:r><w:t>[the 8194 character encoded as above]</w:t></w:r><w:r><w:t>def</w:t></w:r>

    (the 8194 character may be encoded in different ways, but AFAICS the results are the same)

    If, however, you modify the XML so that you have

    <w:r><w:t>abc[the 8194 character encoded as above]</w:t></w:r><w:r><w:t>def</w:t></w:r>

    when you re-open, the STYLEREF field still seems to work. What's more, when you save as Word 2003 XML, this is the encoding used.

    So I would suggest that there could be an error in the way that Word's STYLEREF field deals with text runs that contain certain types of character.


    Peter Jamieson

    Thursday, October 25, 2012 2:05 PM