OpenXml: Excel vs Word - strings

(notes on OpenXml related to the ExcelPackage II project on CodePlex)

OpenXML in Excel 2007 uses /xl/sharedStrings.xml to store all strings.

Given the worksheet /xl/worksheets/sheet1.xml, you can find the actual strings by looking at the xl/sharedStrings.xml file and cross referencing it with the worksheet xml.

/xl/sharedStrings.xml
 
...
<si>
<t>hello</t>                 1st string in sharedStrings == #1
</si>
...
/xl/worksheets/sheet1.xml
 
...
 <row r="4">
      <c r="B4" s="9" t="s">      t="s" indicates that it is type string
        <v>1</v>                  #1 corresponds to the 1st string in sharedStrings.xml
      </c>
...
OpenXml for Word 2007, on the other hand, does not use any shared strings. The text is right in /word/document.xml

A solution like this http://www.rootsilver.com/2008/11/office-2007-open-xml-global-string-replace is handy for replacing text in any OpenXML doc, regardless of type.

Categories

| Comments (0)TrackBacks (0)

0 TrackBacks

Listed below are links to blogs that reference this entry: OpenXml: Excel vs Word - strings.

TrackBack URL for this entry: http://www.rootsilver.com/mt-tb.cgi/101

Leave a comment