c# – InlineString vs String – what's the difference?

Question:

When creating some spreadsheets with OpenXML, the difference between:

  • CellValues.InlineString
  • CellValues.String

Are there any practical differences when inserting texts (eg "hello world"; "stackoverflow")?

Answer:

I found an answer on the OS that talks about this:

  • CellValues.String

It is used to store the text of the formula used in the cell. The XML would look like:

<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>
  • CellValues.InlineString

It is used to store formatted text in the cell as opposed to being the cell code. Note that it would be normal to use the SharedStringTable for this. The XML would look like:

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

I put it on GitHub for future reference .

Documentation .

Scroll to Top