I´m currently trying to export my GridView1 to an XLS- and XLSX-File. My Problem is, that the export is not working. I just get an empty file and the following error:
And I can´t find anything regarding this error..
My code is pretty basic:
Case "barXLS"
fileName = $"C:\Temp\{dt.Year}{dt.Month}{dt.Day}{dt.Second}_Export.xls"
GridView1.ExportToXls(fileName)
Case "barXLSX"
fileName = $"C:\Temp\{dt.Year}{dt.Month}{dt.Day}{dt.Second}_Export.xlsx"
GridView1.ExportToXlsx(fileName)
But I tried a lot of settings for the GridView and for XlsExportOptionsEx but none of them worked. When I try to open the XLS-Sheet I get an error saying that the file is corrupted.
I would really appreciate your help, thank you!
CodePudding user response:
I added the following line to my column-defintions:
columns(i).UnboundDataType = GetType(<DATATYPE>)
After that the export worked as expected.