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

String values treated as numbers and leading zeroes are stripped

Thread ID:





114637 Nov 28,2013 11:32 AM UTC Dec 9,2013 10:12 AM UTC ASP.NET MVC (Classic) 1
Tags: XlsIO
Rory Kingan
Asked On November 28, 2013 11:32 AM UTC

We are exporting data to Excel using XlsIO library. The string values in data table may have leading zeroes. The problem is these values are treated as numbers in Excel and leading zeroes are stripped out. 
Setting worksheet.IsStringsPreserved property to true is not the solution - all the values in the sheet will be treated as strings which is not desired behaviour. 
Also the predefined formatting of the column is ignored - the format of the first column is text, but the values are displayed as numbers with 2 decimal places.
Please see the attached project.
Thanks for advice,


Manoj Kumar G M [Syncfusion]
Replied On December 9, 2013 10:12 AM UTC

Hi Rory Kingan,

Thank you for using Syncfusion products

Please enable the preserveTypes arugment when Importing data table to worksheet.

Following code example illustrates how to import a data table to a sheet

mainsheet.ImportDataTable(dataTable, true, 1, 1,true);



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