How to get cell value of an excel range in c#?

Hi all,
I am developing an excell add-in for some purpose. My add-in needs to get cell values ignoring system regional settings. For example an excel spreadsheet is like in attached file "sample1.jpg".  I get the values of the cells like this:

Excel.Range range = _WorkSheet.get_Range("C1", "C1");
string val = range.Cells.Value2.ToString();
range = _WorkSheet.get_Range("D1", "D1");
string val2 = range.Cells.Value2.ToString();

In English regional settings val = "125,50 TL" and val2 = "18.05.2010". But in Turkish regional settings val = "125,5" and val2 = "40316". Somehow "TL" is ignored and datetime is converted to an int value. I change regional settings to English programatically when my add-in works but the result doesn't change. So i decided to use "Text" property instead of "Value2" property of the Cells. This time everything seems to be ok when all the columns are expanded but when the columns are not expanded to show the values as shown in "sample2.jpg", val = "125,5 TL" and val2 = "########"

So, how can i get the cell values ignoring regional settings and the column's width?

Please help.
 
sample1.jpg
sample2.jpg
ercanclkAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
nicsaintConnect With a Mentor Commented:
Use the following code at the end of your import script to automatically resize the rows, columns, and change the font and font size if required.
Note: SHEET1 is the name of the sheet you are importing the cells to.

       With SHEET1.Cells
            .Font.Name = "Arial"
            .Font.Size = .Font.Size + 0
            .EntireRow.AutoFit
            .EntireColumn.AutoFit
        End With
0
All Courses

From novice to tech pro — start learning today.