OpenXML:XML和Excel工作表具有不同的值

当我使用OpenXML读取Excel工作表时,Excel中的单元格值有不同的值。 这发生在OpenXML生产力工具,我的代码,当我改变扩展到.zip,并在浏览器中查看XML。 例如,这是我的Excel工作表的一部分(对不起,我没有足够的“声誉”在这里张贴工作表的图像):

SAMPLE ID ANALYTE ID RESULT QUANTIFIER RESULT 782-3M-000085 75-35-4 < 0.11 782-3M-000085 56-23-5 < 0.0006 782-3M-000085 156-59-2 < 0.497 782-3M-000085 75-69-4 < 0.0009 782-3M-000085 67-66-3 < 0.008 782-3M-000085 76-13-1 < 0.006 782-3M-000085 127-18-4 1.79 

和XML看起来像这样(对于它的一部分):

  <row r="1" spans="1:18" ht="38.25" x14ac:dyDescent="0.2"> <cr="A1" s="30" t="s"> <v>103</v> </c> <cr="B1" s="30" t="s"> <v>6</v> </c> <cr="C1" s="30" t="s"> <v>24</v> </c> <cr="D1" s="30" t="s"> <v>104</v> </c> <cr="E1" s="30" t="s"> <v>105</v> </c> </row> <row r="2" spans="1:18" x14ac:dyDescent="0.2"> <cr="A2" t="s"> <v>48</v> </c> <cr="B2" t="s"> <v>115</v> </c> <cr="C2" s="36" t="s"> <v>116</v> </c> <cr="D2"> <v>0.11</v> </c> <cr="E2" t="s"> <v>117</v> </c> </row> <row r="3" spans="1:18" x14ac:dyDescent="0.2"> <cr="A3" t="s"> <v>48</v> </c> <cr="B3" t="s"> <v>123</v> </c> <cr="C3" s="36" t="s"> <v>116</v> </c> <cr="D3"> <v>5.9999999999999995E4</v> </c> </row> <row r="4" spans="1:18" x14ac:dyDescent="0.2"> <cr="A4" t="s"> <v>48</v> </c> <cr="B4" t="s"> <v>124</v> </c> <cr="C4" s="36" t="s"> <v>116</v> </c> <cr="D4"> <v>0.497</v> </c> </row> 

有人知道我在做什么错吗? 我试图将工作表中的值导入到我的代码中。

@psantiago是正确的 – 你正在处理“共享string”。

单元元素的“t”属性告诉你单元元素中的数据是什么types的。 (OpenXml标准中的第18.3.1.4节)。 在这种情况下,'s'值告诉你这个值是一个到SharedStrings文件的索引。 (第18.18.11节ST_CellType(Cell Type))。 因此,在SharedStrings.xml文件中的索引48处,您将find所需的信息。

还请看与包含值“0.11”的单元格的区别。

 <cr="D2"> <v>0.11</v> </c> 

它没有“单元格数据types”属性,因此该值直接在单元格中为“0.11”。

您可以在http://standards.iso.org/ittf/PubliclyAvailableStandards/index.html获取完整的文&#x6863; – search“ISO / IEC 29500-1:2012”页面