I have a text file that I'm importing into the grid, and then out to excel, running on a Windows Server machine that doesn't have Office installed.
Sometimes, a single cell, say in a Quantity on Hand field, which is a number, is not a number, but a string like 'Obsolete' or 'No Longer Available'. If I import this data into Excel directly on my personal machine, I use the import wizard (it's a tab-delimited text file), and set the column to numeric, and numbers appear as number, right justified, and any text in a cell in the column appears as text, left justified.
I'm trying to duplicate this behavior in exporting the grid to Excel, but since I've mapped the grid to a data table, and all of the table's columns are typed as string, since putting 'Obsolete' in an Int16 column would blow it up, I don't know how to format all my numbers as numbers and text as text. Instead, everything exports to Excel as text, and I get those lovely diamonds telling me that all these numbers are bing treated as text.
So, I need a way to test the value, see if it's a number, a data, text, what have you, and format that individual cell, rather than all cells in the column.
Can this be accomplished with the Grid?
Thanks.
Hi Samuel,
We spoke earlier about this on the phone and the advice I provided was to test the type using TryParse in the CellExporting event. Is this working for you, or did you have further questions?