I am updating a Excel Worksheet cell value to 2009.03 and it become change to 2009.3.
I tried may ways to solve the issue but value always changed to "2009.3" instead of "2009.03" on Server. It is working on my system but not on Win XP 2003 Server System.
I used to set excel cell NumberFormat to "@", "0.00", "####.##" and even tried to concatenated "'" before value but result not come. The excel file is of 2007 format(.xlsx). >My Code is
Microsoft.Office.Interop.Excel.Workbook WorkBook = null;
Microsoft.Office.Interop.Excel.Worksheet Sheet = null;
WorkBook = Utility.GetWorkbook2007(templateFileWPath);
Sheet = (Microsoft.Office.Interop.Excel.Worksheet)WorkBook.Worksheets[1];
Microsoft.Office.Interop.Excel.Range TPCellRange = (Microsoft.Office.Interop.Excel.Range)Sheet.Cells[this.GetRowIndex(Sheet, this.CellAddress), this.GetColumnIndex(Sheet, this.CellAddress)];
TPCellRange.set_Value(Microsoft.Office.Interop.Excel.XlRangeValueDataType.xlRangeValueDefault,"2009.03");
or also tried
CellValueRange.NumberFormat = "@";
CellValueRange.set_Value(Microsoft.Office.Interop.Excel.XlRangeValueDataType.xlRangeValueDefault, "2009.03");