This is a migrated thread and some comments may be shown as answers.

Formatting Numbers with leading Zero to Text

1 Answer 575 Views
Spreadsheet
This is a migrated thread and some comments may be shown as answers.
Kevin
Top achievements
Rank 1
Kevin asked on 26 Nov 2015, 03:08 PM

taking data from a db into the spreadsheet, and I have a column that is numbers, but they start with a zero (0123456789)

When the data goes in it is ok, but any edits to the cells that also contain a zero ie 01234, will turn into 1234.

How can I stop this from happening, as I require the leading zero to be there.

I would think this would also apply to any new lines been added, I would need this been stopped also.

 

Many thanks

 

1 Answer, 1 is accepted

Sort by
0
Nikolay Demirev
Telerik team
answered on 30 Nov 2015, 09:30 AM
Hi Kevin,

You could set the number format for the cells or rows or columns you use to text. This can be achieved using the following code:
this.radSpreadsheet.ActiveWorksheet.Columns[0, 1].SetFormat(new CellValueFormat("@"));

Or some other number format that suits your needs here you can find more information on how to construct the format strings.

Regards,
Nikolay Demirev
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Spreadsheet
Asked by
Kevin
Top achievements
Rank 1
Answers by
Nikolay Demirev
Telerik team
Share this question
or