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

Format string with zero's?

Thread ID:

Created:

Updated:

Platform:

Replies:

116922 Jul 1,2014 07:45 AM UTC Jul 2,2014 10:58 AM UTC WinForms 1
loading
Tags: XlsIO
dsad
Asked On July 1, 2014 07:45 AM UTC

Hi, im trying to format a string like 000055555 in a excel sheet. But its is imposible, the excel generated show the string as number like this.

555555

My code is this, 

        sheet.Columns[10].CellStyle.NumberFormat = "@";

thankss

Carlos
                


Prakash Kumar D [Syncfusion]
Replied On July 2, 2014 10:58 AM UTC

Hi Carlos,

 

We suspect this as a usage issue. You might have used Value or Value2 property instead of Text property. Value or Value2 property converts the data type as per value in the cell. In your scenario, number “00005555” is trying to store as text initially and the number format is applied. So, the value is already converted to number while assigning, and the cell type is changes to Text later. We recommend to use the Text property in order to get the issue resolved. We have attached the code snippet for your reference.

 

Code Snippet:

 


sheet["A1"].Text = "000055555";

sheet.Columns[0].CellStyle.NumberFormat = "@";

              

 

Regards,

Prakash


CONFIRMATION

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.

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

;