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 : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Zeros left in a column

Thread ID:

Created:

Updated:

Platform:

Replies:

129394 Mar 15,2017 04:22 PM UTC Mar 17,2017 07:25 AM UTC ASP.NET Web Forms 3
loading
Tags: XlsIO
Juan
Asked On March 15, 2017 04:22 PM UTC

Hi.
I am trying to put in a column text with leading zeroes "0041123", and applying NumberFormat = "@" to the column it is formated as Text, but no zeros appear. Only "41123".

What do I have to apply to NumberFormat for zeros to appear?

Greetings.



Abirami Varadharajan [Syncfusion]
Replied On March 16, 2017 07:40 AM UTC

Hi Juan, 
 
Thank you for contacting Syncfuison support. 
 
Kindly try below code to preserve the number preceding with 0’s as text.  
 
Code Example: 
            sheet.Range["A1"].Text = "0041123"; 
            sheet.Range["A1"].NumberFormat = "@"; 
            sheet.Range["A1"].IgnoreErrorOptions = ExcelIgnoreError.NumberAsText; 
 
Please let us know if you have any concerns. 
 
Regards, 
Abirami 


Juan
Replied On March 16, 2017 08:27 AM UTC

Thank you very much for the quick response.
I got it working by modifying the data import:


worksheet.ImportDataTable(Datos, True, 1, 1, True)

I did not know the "IgnoreErrorOptions" option.

Thank you.


Abirami Varadharajan [Syncfusion]
Replied On March 17, 2017 07:25 AM UTC

Hi Juan, 
 
Thank you for updating us. 
 
We are glad that the issue is resolved at your end. Please let us know if you need any further assistance. 
 
Regards, 
Abirami. 


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

;