Common rows in Excel 2010

Can someone help me understand common strings in MS Excel? I tried to understand using some blogs, but could not get the full idea. Everyone explains how to access the Shared String using Open XML and where the Shared String is stored (like sharedStrings.xml ). Access using the API is fine. But,

  1. How to create shared rows in Excel. (Manual creation in Excel 2010 without using the API)
  2. What is the exact need for shared lines?
  3. When can I use Shared Strings?

I tried to follow.

http://www.sadev.co.za/content/reading-and-writing-excel-2007-or-excel-2010-c-part-iii-shared-strings

http://msdn.microsoft.com/en-us/library/gg278314.aspx

+7
source share
1 answer

Shared strings are basically a space saving mechanism. Regarding your questions:

A1 . You cannot manually create shared rows using the Excel user interface. This is because Excel always saves any text as a common string by default.

A2 . As mentioned, this is a space saving mechanism. Excel 2007/2010/2013 uses the Open XML format, which is basically a bunch of XML files zipped together. It can also be a facilitation of links. You just need to access the index, just like you are referencing the index of an array of strings. (But XML is essentially verbose, so I suspect it in order to save space).

Say you have the text “This is a very long line” in cell A1 of the “FirstSheet”. Say you also have the same text in cell B7 of the SecondSheet. Excel stores “This is a very long text” in the table of shared lines as a single record, say index 5. In cell A1, “FirstSheet”, the Open XML SDK class cell will contain only “5” as CellValue. In cell B7, "SecondSheet", the SDK cell will also contain "5".

Basically, CellValue only supports an index in a common row table. Here's how you saved space. It is assumed that the text is duplicated both on a sheet and on different sheets.

A3 . Go for general lines if you understand how to make it work. If not, just set the actual text in the Cell class to CellValue (Cell.DataType as CellValues.String instead of CellValues.SharedString).

+11
source

All Articles