I have a 60x90 worksheet from importing a tab delimited file. Saving the worksheet and viewing in Excel it appears normal with first row as column labels which is desired. Trying to put this worksheet into a DataTable produces the following stack trace:
Unhandled Exception: System.Data.DuplicateNameException: A column named ' ' already belongs to this DataTable.
at System.Data.DataColumnCollection.RegisterColumnName(String name, DataColumn column, DataTable table)
at System.Data.DataColumn.set_ColumnName(String value)
at Aspose.Cells.Cells.ExportDataTableAsString(Int32 firstRow, Byte firstColumn, Int32 rowNumber, Int32 columnNumber, Boolean exportColumnName)
This occurs for any column count greater than 1 and for any row count. The code for this action follows. This is being done in VS 2005 J#.
// Prepare the DataTable of mail merge fields
Workbook workbook = new Workbook();
workbook.Open("samples/CPNTexas3.TXT", FileFormatType.TabDelimited);
// Test the format of the inported file.
//workbook.Save("Texas3.xls", FileFormatType.Excel97);
Worksheets wkshts = workbook.get_Worksheets();
Worksheet wksht = wkshts.get_Item(0);
Aspose.Cells.Cells cells = wksht.get_Cells();
// Create a DataTable from the worksheet
DataTable dataTable = cells.ExportDataTableAsString(1, (ubyte)1, 1, 2, true);
The first three column labels in row 1 are: batch_no, barcode_data, barcode_human.
The .NET reference says Cells version 4.0.2.0 and Runtime v1.0.3705.
Can you tell me what is wrong ?
***