I want to import excel to devexpress grid.
When I runing in my PC, It work well.
But "Invalid file signature" error occurs in customer's PC.
So I get the customer's excel file(.xlsx) and open it my PC.
No error occurs in my PC. ...Why?
Here, my code to open excel file.
Dim stream As FileStream = File.Open(filePath, FileMode.Open, FileAccess.Read)
If UCase(strExt) = "XLS" Then
Dim excelReader As IExcelDataReader = ExcelReaderFactory.CreateBinaryReader(stream)
Dim excelDsConf As ExcelDataSetConfiguration = New ExcelDataSetConfiguration()
excelDsConf.ConfigureDataTable = Function() New ExcelDataTableConfiguration() With {
.UseHeaderRow = True
}
DtSet = excelReader.AsDataSet(excelDsConf)
DtSet.Tables(0).TableName = "ExcelData"
Else 'XLSX
Dim excelReader As IExcelDataReader = ExcelReaderFactory.CreateOpenXmlReader(stream)
Dim excelDsConf As ExcelDataSetConfiguration = New ExcelDataSetConfiguration()
excelDsConf.ConfigureDataTable = Function() New ExcelDataTableConfiguration() With {
.UseHeaderRow = True
}
DtSet = excelReader.AsDataSet(excelDsConf)
DtSet.Tables(0).TableName = "ExcelData"
End If
.Netframework is 4.0
Why "Invalid file signature" error occur in customer's PC?
What should I check on the customer's PC?