动态生成的Excel Xml(通过OpenXml)在其所有标记中都有一个x:
因此,我在一个空工作簿(已经建立了数据连接)上动态创建了一个数据透视表,并成功保存:文档甚至成功打开。为什么Excel GUI:一切看起来都正常,工作正常 当我查看包的内部时,我发现Xml标记有一个extar x:,比如workbook.Xml就像bellow动态生成的Excel Xml(通过OpenXml)在其所有标记中都有一个x:,excel,pivot,openxml,Excel,Pivot,Openxml,因此,我在一个空工作簿(已经建立了数据连接)上动态创建了一个数据透视表,并成功保存:文档甚至成功打开。为什么Excel GUI:一切看起来都正常,工作正常 当我查看包的内部时,我发现Xml标记有一个extar x:,比如workbook.Xml就像bellow <x:pivotCaches> <x:pivotCache cacheId=”1″ r:id=”rId4″ /> </x:pivotCaches> 有人知道为什么我们有这个额外的x:?只
<x:pivotCaches>
<x:pivotCache cacheId=”1″ r:id=”rId4″ />
</x:pivotCaches>
有人知道为什么我们有这个额外的x:?只有将pivotCaches标记添加到workbook.xml后,才会发生这种情况。我使用的是OpenXml 2.7.1,
x:
前缀称为。您还必须在XML文件中看到一个xmlns:x
属性,该属性指示如何解析此命名空间的架构。x:
前缀称为。您还必须在XML文件中看到一个xmlns:x
属性,该属性指示如何解析此命名空间的架构。x:pivotCaches
中的x
是一个XML命名空间前缀
对于XML,必须有一个声明将名称空间前缀x
与名称空间URI绑定,如http://schemas.openxmlformats.org/spreadsheetml/2006/main
。当前的XML片段的名称空间格式不正确,因为它使用了未声明的XML名称空间前缀
名称空间前缀可以在其使用历史的任何位置或更高位置声明:
<x:pivotCaches xmlns:x="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
<x:pivotCache cacheId=”1″ r:id=”rId4″ />
</x:pivotCaches>
如果改为声明默认XML命名空间,则可以省略命名空间前缀:
<pivotCaches xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
<pivotCache cacheId=”1″ r:id=”rId4″ />
</pivotCaches>
另请参见
x:pivotCaches
中的x
是一个XML名称空间前缀
对于XML,必须有一个声明将名称空间前缀x
与名称空间URI绑定,如http://schemas.openxmlformats.org/spreadsheetml/2006/main
。当前的XML片段的名称空间格式不正确,因为它使用了未声明的XML名称空间前缀
名称空间前缀可以在其使用历史的任何位置或更高位置声明:
<x:pivotCaches xmlns:x="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
<x:pivotCache cacheId=”1″ r:id=”rId4″ />
</x:pivotCaches>
如果改为声明默认XML命名空间,则可以省略命名空间前缀:
<pivotCaches xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
<pivotCache cacheId=”1″ r:id=”rId4″ />
</pivotCaches>
另请参见