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

Free Support Forum - aspose.com

Conversion to Tab delimited form not correct

I am importing a data table into a worksheet and then saving the workbook in the Tabdelimited format.

But if the column header has a space (eg First Name), it takes the second string as another column and hence the tab delimited text has two columns.

Please let me know if there is a solution to this.

Hi,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for considering Aspose.

Well, I tested your scenario a bit with the attached latest version of Aspose.Cells and I was unable to reproduce the issue you mentioned. Following is my sample code and attached is the resultant file for your reference:

//Instantiate a new Workbook.

Workbook excelbook = new Workbook();

//Instantiating a "Products" DataTable object

DataTable dataTable = new DataTable("Products");

//Adding columns to the DataTable object

dataTable.Columns.Add("Product ID", typeof(Int32));

dataTable.Columns.Add("Product Name", typeof(string));

dataTable.Columns.Add("Units In Stock", typeof(Int32));

//Creating an empty row in the DataTable object

DataRow dr = dataTable.NewRow();

//Adding data to the row

dr[0] = 001;

dr[1] = "Aniseed Syrup";

dr[2] = 15;

//Adding filled row to the DataTable object

dataTable.Rows.Add(dr);

//Creating another empty row in the DataTable object

dr = dataTable.NewRow();

//Adding data to the row

dr[0] = 002;

dr[1] = "<?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" />Boston Crab Meat";

dr[2] = 123;

//Adding filled row to the DataTable object

dataTable.Rows.Add(dr);

excelbook.Worksheets[0].Cells.ImportDataTable(dataTable, true, 0, 0,false,false);

excelbook.Save("C:\\text.txt", FileFormatType.TabDelimited);

Please try the attached latest version of Aspose.Cells and if you still face any problem, please share your sample code and resultant file to reproduce the issue and we will check it soon.

Thank You & Best Regards,

Hi,

I am using the Aspose 4.7.1.0 Version. Can you tell me if this problem exists in that version as I am working on an existing project and cannot change the Aspose.Cells dll.

I am also attaching the excel file and resulting text file for reference.

Hi,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for your template and generated files.

Your resultant file “Temp.txt” opens fine in MS Excel (column headers are showing properly). Also, I tested your issue with V4.7.1 and it works fine too. I also converted your provided template xls file to tab delimited file by using MS Excel and the result of MS Excel conversion and Aspose.Cells conversion are the same. Please check it by manually converting your file in MS Excel. Also, if you still face any issue, please mark it in your resultant file and let us know. We will further look into it.

Thank you & Best Regards,