I use Open XML to load excel file,I want to extract all content of cells.First I try to get the format code and the inner text of the cell, but it seems that Open XML SDK does not provide the functionality of formatting the inner text with the format code.
-
possible duplicate of [open xml excel read cell value](http://stackoverflow.com/questions/5115257/open-xml-excel-read-cell-value) – Jesper Lund Stocholm Oct 21 '14 at 08:17
1 Answers
The data you are looking for will most likely not be in the inner text of the Cell element.
I found this Q on SO that will answer most of your questions:
open xml excel read cell value .
It is true that OpenXml SDK does not provide a way to "convert" a value of a Cell using the format code - you need to do that conversion yourself. So you need to figure out exactly what kind of data is in your cell.
Example:
If your cell in the spreadsheet displays a date, find the value of the "value" attribute of the Cell object, convert the numeric representation of the date to a "regular date" and use the Cell style to format it the correct way.
Example:
If your cell in the spreadsheet displays a piece of text, find the index to the item in the SharedStrings-table and get the value from that.
The link above will give you pointers to do most of these things. It might seem a bit tricky at first, but you'll soon get the idea.
:-)

- 1
- 1

- 1,973
- 2
- 27
- 49