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. Image for the cookie policy date
close icon

String values treated as numbers and leading zeroes are stripped

Hi.
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,
Rory


XslIoSample_cb6c6fa8.zip

1 Reply

MK Manoj Kumar G M Syncfusion Team 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);


Regards,
Manojkumar.

Loader.
Up arrow icon