Trim leading spaces while exporting excel data into Datatable

Hello Aspose Team,

I am using aspose cell licence version.

While exporting excel data into datable, I need to trim the leading spaces of excel cell.
Kindly help me in this.

Below is the method, which I using for exporting excel data into datable.

dataTable = worksheet.Cells.ExportDataTable(startRow, startColumn, worksheet.Cells.MaxDataRow + 1, worksheet.Cells.MaxDataColumn + 1, new ExportTableOptions() { CheckMixedValueType = true, ExportColumnName = true });


Thanks for your posting and using Aspose.Cells.

Please provide us sample console application running your code and also sample excel files used inside it. Also if you could provide expected excel files. We will execute your code and improve it to meet your requirements. Thanks for your cooperation.

Hi @shakeel.faiz, I had this same question. Is there a solution to this?

Do you need to remove leading spaces for those cells whose values are string such as " abc" and you need the value to be changed and exported as “abc”? If so, we think you may implement the method ExportTableOptions.PreprocessExportedValue to change the output value while exporting.

If it is not your requirement, please describe it with more details, such as providing one sample file and the expected results for exporting, we will try to provide the proper solution for you.