When I export some data to excel, and open it with excel 2003, every number cell has a green triangle in the top left corner and has the error "Number stored as text". How do I specify that the cell contains a number?
The way I'm adding data to the excel file is:
Workbook workbook = new Workbook();workbook.Worksheets.Clear();Worksheet sheet = workbook.Worksheets.Add("Test");sheet.Rows[0].Cells[0].Value = "String"sheet.Rows[0].Cells[1].Value = 0.0;BIFF8Writer.WriteWorkbookToFile(workbook, filename);
Thanks.
-Nick
Hi Nick,
I just ran the code you have here and it works fine for me. You should not have to do anything special - numbers should be exported as numbers.
What version of the controls are you using? Perhaps you need to get the latest service release? How to get the latest service release - Infragistics Community
How do you set the export datatype when the grid is bound to a datatable that has double dataype columns.
Hi Joseph,
If the data in the grid is type double, then the UltraGridExcelExporter will export it to Excel as a double. You don't have to do anything.
If the data in your Excel sheet is the wrong type, then it's either the wrong type in the grid (maybe you are storing it in your data source as a string) or else something in your code is exporting it incorrectly.
If you are storing numeric data as strings, that will cause all sorts of problems with filtering, sorting, and exporting. So the best thing to do would be to store the data as a double. But if you can't do that, you could handle the CellExported event and write it to the cell directly.