Excel Header with Spaces

Our outside provider that we export and import data using an excel sheet changed their header values. What used to be “ContactFirstName” is now “Contact First Name”. This is giving me an error that it cannot find a cell with “Contact First Name” even though it does it exist. Do I have to change something in my code below to recognize spaces in the header or can I somehow strip the spaces from the header? If I remove all spaces from the header and update the fields to look for to have no spaces everything is fine.


Dim workbook As Workbook = New Workbook()
Dim fstream As FileStream = New FileStream(“d:\hart11dev\filecabinet\temp\HarrisTemp_” + Request.QueryString(“ID”) + “.xls”, FileMode.Open)
workbook.Open(fstream)
Dim worksheet As Worksheet = workbook.Worksheets(0)
Dim dTable As DataTable = New DataTable()
dTable = worksheet.Cells.ExportDataTable(0, 0, workSheet.Cells.MaxRow + 1, workSheet.Cells.MaxColumn + 1, True)
Dim row As DataRow
For Each row In dTable.Rows
Dim FirstName As String = Replace(row(“Contact First Name”).ToString(), “’”, “’’”)

Hi,

Thanks for your posting and using the Aspose.Cells for .NET.

Please elaborate yourself more with some screenshots and sample source/output xls/xlsx files and the code example.

Please also test your issue with the latest version:
Aspose.Cells
for .NET v7.1.0.1
and let us know your feedback.

We will look into it and help you asap.