Formatting a cell as text

Jun 13, 2011 at 10:06 AM

Hi, I am trying to set certain cells in a spreadsheet as text but I can't work out how. Currently if certain value are entered (like "true" or "false") they are set to be a different data type which is not what I want. The text value must remain as the user enters it. How can I do this?

Jun 13, 2011 at 3:25 PM

Make sure it is a string. If you have an numeric value use the ToString method to convert it...

int number=1;
Jun 13, 2011 at 4:22 PM

No, I mean when a person edits a spreadsheet created using this library I want their input to be treated as text, not as a number or a date etc. You can do this within excel using "format cells" and setting it as text. If someone inputs the word "true" excel changes the data type to boolean and the value when read is "1.0".  The values that the user inputs must remain as they type them.

Jun 13, 2011 at 4:23 PM

I forgot to mention, I am setting the value of the cells as string.Empty when creating the spreadsheet. 

Jun 14, 2011 at 12:08 PM
Set the numberformat to @, like...