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?
The SharedStringItem class represents the shared string item (<si>) element which represents an individual string in the shared string table. If the string is a simple string with formatting applied at the cell level, then the shared string item contains a single text element used to express the string.
Office Open XML (also informally known as OOXML) is a zipped, XML-based file format developed by Microsoft for representing spreadsheets, charts, presentations and word processing documents. Ecma International standardized the initial version as ECMA-376. ISO and IEC standardized later versions as ISO/IEC 29500.
OpenXML is also known as OOXML and it fully XML-based format for office documents, including word processing documents, spreadsheets, presentations, as well as charts, diagrams, shapes, and other graphical material.
The workbook. xml. rels file contains the <Relationship> elements that define the relationships between the workbook and the worksheets it contains. The following XML code is the spreadsheetML that represents the relationship part of the spreadsheet document.
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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With