1

The OOXML specification says that an SpreadsheetML cell may have a string stored in the shared strings area, or may be a Rich Text Inline element, like this:

<row r="1" spans="1:1">
  <c r="A1" t="inlineStr">
    <is><t>This is inline string example</t></is>
  </c>
</row>

Every test I've been doing with Excel puts strings in the shared strings area, even if they contain inter-cell formatting.

Does Excel ever create files that use the Rich Text Inline feature?

eaolson
  • 14,717
  • 7
  • 43
  • 58
  • I don't think so as Excel keeps the style information separate https://stackoverflow.com/questions/10142095/style-for-wrapped-text-with-spreadsheetml. In the VBA editor you can try `MsgBox [A1].Value(11)` (or `.Value(12)`) and see if you can hack that in the OOXML – Slai Jun 05 '17 at 00:08
  • 1
    I have not seen Excel ever do this. However, we wrote our own SML exporter that uses IS's for everything (why not?!) and I have seen Excel re-save that file with styles applied to it. I'm recall this caused my importer to fail because it split the IS into two halves, each with a different style. I cannot recall if it also replaced the IS's with separate shared strings though. – Maury Markowitz Jul 10 '17 at 14:44

1 Answers1

0

I tried on Microsoft Excel and LibreOffice, it's not possible to create Rich Text Inline strings with these applications. It appears the InlineStrings feature is supported only for the Open XML SDK.

It's possible to generate an Open XML document with the SDK that contains Inline Strings and Microsoft Excel and LibreOffice can open these documents successfully.

However if the file is edited in these applications, the file is updated and the InlineStrings are moved to SharedStrings.

Before

OpenXML SDK InlineString

After

OpenXML SDK SharedStrings

If the file is created and updated only using the Open XML SDK the InlineStrings are persisted and not moved to the SharedStringsTable.

I believe the InlineStrings feature is only relevant when working with files generated by the SDK. It is more convenient to lookup the value rather than mapping to the SharedStringTable using the SharedStringItem index.

Lookup value from the SharedStringTable: https://stackoverflow.com/a/31739945/1165173

nimblebit
  • 473
  • 3
  • 11
  • 22