We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Formatting Numbers as Text

Thread ID:





75074 Jul 10,2008 11:18 PM UTC Feb 19,2018 09:48 PM UTC WinForms 2
Tags: XlsIO
Administrator [Syncfusion]
Asked On July 10, 2008 11:18 PM UTC

Many of our account numbers have leading zeros. I'd like to be able to format the account number column as text so that 001 shows up in the spreadsheet as 001 and not 1. This is particularly helpful if the user adds new account numbers to the spreadsheet after it is created. Essentially the same thing as right clicking on a column in Excel, select "Format Cells" and then selecting Text from the Categories list. I cannot find anywhere in the documentation or examples that will allow me to do this.


Yavanaarasi G [Syncfusion]
Replied On July 11, 2008 11:05 AM UTC

Hi Todd,

Thank you for your interest in Syncfusion products.

You can format the cell as text by using NumberFormat. For leading Zeros you have to set the format as "00#". Please refer the below code snippet:

sheet.Range["A1"].Number = 0001;
sheet.Range["A1"].NumberFormat = "00#";

Here is the sample for your reference:

Please try this and let me know if this helps.


Replied On February 19, 2018 09:48 PM UTC



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon