and in Office Open XML? What is the difference between the two snippets of Office Open XML? ...">

What is the difference between <ct = "str"> and <c> <is> in Office Open XML?

What is the difference between the two snippets of Office Open XML?

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

and

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

note: the second sample that I manually created based on the specification, the first from a real Excel workbook.

Both seem valid and pretty much identical in spec, so I wonder why t="str" exists when <is> seems to do the same. When does Excel prefer to use one over the other?

+6
excel spreadsheetml openxml xlsx openxml-sdk
source share
1 answer

According to the documentation on 18.18.11 ST_CellType :

str (String) A cell containing the formula string.

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

The second is used for inline strings, and the <x:c> element must have the t 'inlineStr' attribute. It will be just rich text that will be displayed and not stored in the sharedstring table.

So your first one will be valid as follows:

 <x:cr="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 will be valid as follows:

 <x:cr="B2" t="inlineStr"> <is><t>btyler</t></is> </c> 
+8
source share

All Articles