2.1.1747 Part 1 Section 22.9.2.19, ST_Xstring (Escaped String)

a.   The standard places no restrictions on the characters that can be escaped in the contents of the ST_Xstring simple type.

Office does not allow the newline (0x000A) or tab (0x0009) characters to be escaped in this simple type's contents.

b.   The standard implies that the only characters that can be Xstring encoded are invalid XML characters.

The following four cases represent valid XML characters that should be escaped:

  • Carriage Return (0x000D): This character shall be escaped.

  • Line Feed (0x000A): This character shall be escaped only when used in an attribute.

  • Tab (0x0009): This character shall be escaped only when used in an attribute.

  • Underscore (0x005f): This character shall be escaped only when used to escape the first underscore character in the format _xHHHH_.

c.   The standard allows Xstring to encode underscores using _x005f_.

In Excel, Xstrings may only contain the escape sequence _x005f_ when escaping the lead underscore from a string in the form _xHHHH_.