NumericData

Can you please point me in the right direction on how to correctly use ConvertNumericData when you are creating a new Workbook but not loading in a file? I have found plenty of examples of the correct way to use it when loading a file.
LoadFormat format = LoadFormat.Excel97To2003;

LoadOptions loadOptions = new LoadOptions(format) {ConvertNumericData = false};
Workbook workbook = new Workbook(sourceFile.ToString(), loadOptions);
Worksheet worksheet = workbook.Worksheets[0];
Cells cells = workbook.Worksheets[0].Cells;

However, when I'm not loading a file, such as this:

Workbook workbook = new Workbook { Settings = { ConvertNumericData = false } };
Worksheet worksheet = workbook.Worksheets[0];
Cells cells = worksheet.Cells;

//Export
cells.ImportCustomObjects(_PayrollImportList, null, true, 0, 0, 60000, false, "MM/dd/yyyy", false);

It tells me it's obsolete and I haven't been able to find the correct way to code it.

Thanks

Hi,


Well, yes, the WorkbookSettings.ConvertNumericData is obsoleted in the new versions. We will check if we can provide some way or options for specifying ConvertNumericData option when we are creating a new Workbook and not loading an existing file.

I have logged a ticket with an id “CELLSNET-41626” for your case. Once we sort it out, we will let you know here.

Thank you.

Hi,

Thanks for your posting and using Aspose.Cells.

ConvertNumericData property will take effect only when loading txt
format template files. So it should be only used for TxtLoadOptions when
loading txt format template files and we make it obsolete from
WorkbookSettings.


When importing data into cells after creating an empty Workbook, user should use the corresponding parameter to denote whether string value should be converted to numeric if possible.

Such as in user's code example of using cells.ImportCustomObjects(_PayrollImportList, null, true, 0, 0, 60000, false, "MM/dd/yyyy", false);

Set the last parameter as true will let this method convert numeric values in string format to number automatically.