< c t =" str">和< c>< is>在Office Open XML中? [英] What's the difference between <c t="str"> and <c><is> in Office Open XML?

查看:234
本文介绍了< c t =" str">和< c>< is>在Office Open XML中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这两个Office Open XML片段有什么区别?

 < cr =A2t =str > 
< v> btyler< / v>
< / c>

 < CR = B2 > 
< is>< t> btyler< / t>< / is>
< / c>

注意:第二个示例是我根据规格手动创建的,第一个是从实际的Excel工作簿。



根据规范,两者似乎都有效,几乎相同,所以我想知道为什么会有 t =str< is> 似乎做同样的事情。

解决方案

根据 18.18.11 ST_CellType


str(String)包含公式
string的单元格


所以,如果一个公式在< x:v> 元素



第二个用于内联字符串,而< x:c> 元素应该有一个 t 属性'inlineStr'。这将只是富文本,将被输出而不存储在共享字符串表中。



所以你的第一个将是这样有效的:

 < x:cr =C6s =1vm =15t =str> 
< x:f> CUBEVALUE(xlextdat9 Adventure Works,C $ 5,$ A6)< / x:f>
< x:v> 2838512.355< / x:v>
< / x:c>

您的第二个将如下所示:

 < x:cr =B2t =inlineStr> 
< is>< t> btyler< / t>< / is>
< / c>


What's the difference between these two Office Open XML fragments?

<c r="A2" t="str">
  <v>btyler</v>
</c>

and

<c r="B2">
  <is><t>btyler</t></is>
</c>    

note: The second sample I created manually based on the spec, the first is from an actual Excel workbook.

Both seem valid and pretty much identical according to the spec, so I'm wondering why there is t="str" when <is> seemingly does the same thing. When does Excel choose to use one over the other?

解决方案

According to the documentation at 18.18.11 ST_CellType:

str (String) Cell containing a formula string.

So you would only use your first example if a formula was in the <x:v> element.

The second one is used for inline strings and the <x:c> element should have a t attribute of 'inlineStr'. This will just be rich text that will be outputted and not stored in the sharedstring table.

So your first one would be valid like this:

<x:c r="C6" s="1" vm="15" t="str">
   <x:f>CUBEVALUE("xlextdat9 Adventure Works",C$5,$A6)</x:f>
   <x:v>2838512.355</x:v>
</x:c>

Your second one would be valid like this:

<x:c r="B2" t="inlineStr">
   <is><t>btyler</t></is>
</c>

这篇关于&lt; c t =&quot; str&quot;&gt;和&lt; c&gt;&lt; is&gt;在Office Open XML中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆