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

Numerical string keeps dropping zeros

Thread ID:





54576 Jan 11,2007 04:15 PM UTC Jan 12,2007 01:12 PM UTC ASP.NET Web Forms (Classic) 1
Tags: XlsIO
Asked On January 11, 2007 04:15 PM UTC

I have a column of postal codes that I'm setting up as a string since many postal codes will contain leading zeros(i.e. "04438", "00110") however when my xls sheet opens, it eliminates the leading zeros (i.e. "4438", "110").

I'm trying to set this by first populating the spreadsheet with the data and then formatting the column:
sheet.Columns[0].HorizontalAlignment = ExcelHAlign.HAlignCenter;
sheet.Columns[0].ColumnWidth = 11;
sheet.Columns[0].NumberFormat = "@";

I would think that by using "@" as the numberFormat, that would prevent the leading zeros from dropping however that doesn't seem to be the case.

Any idea on what I should do?



Melba Winshia [Syncfusion]
Replied On January 12, 2007 01:12 PM UTC

Hi Ryan,

Could you please try using the following code snippets to set the postal codes with the leading zeros?


//Number format to preserve the leading zeros

//Import array of objects
sheet.ImportArray( arrInt, 1, 1, true );

Here is the sample for your reference:


Please take a look at the sample above and let me know if you have any other questions.

Best Regards,


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

This page will automatically be redirected to the 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