We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to preserve leading zeros in column when using ImportCustomObjects

I need to preserve the leading zeros in some columns when creating a spreadsheet using ImportCustomObjects. I have tried using ImportTableOptions.ConvertNumericData = false.

@mlugo.penntreaty,

Thanks for your query.

Please note, when you enter a value 00001 into a cell in Ms Excel, Ms Excel omits leading zeros from the value and gives/displays you 1

Generally there are two ways to have leading zeros in Excel worksheet cells:

  1. Either start your value with single quote, i.e., '00001 or use =“00001” to preserve the leading zeros.
  2. Your so called numeric data should be string/text.

In short, you should have those numeric list type field(s) to be imported into Excel sheet. Alternatively (after you have imported data into the worksheet cells), you may loop through each cell in that column and re-enter or convert to string.

Hope, this helps a bit.