Excel accepts some characters whereas OpenXml has error

孤街醉人 提交于 2019-12-04 16:11:37

You need to write it using the format _xHHHH_ where H represents a hexadecimal character. In your particular instance you need to set the value to "_x001F_".

From the documentation for a Cell Value:

The possible values for this element are defined by the ST_Xstring simple type (§22.9.2.19).

In turn, the ST_Xstring (taken from the ECMA-376 standard) is documented as:

22.9.2.19 ST_Xstring (Escaped String)
String of characters with support for escaped invalid-XML characters. For all characters which cannot be represented in XML as defined by the XML 1.0 specification, the characters are escaped using the Unicode numerical character representation escape character format xHHHH, where H represents a hexadecimal character in the character's value. [Example: The Unicode character 8 is not permitted in an XML 1.0 document, so it must be escaped as x0008. end example]

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!