In the current implementation, when exporting a DataTable to excel via InsertTable method, if a DataColumn.Caption is not null or whitespace then the DataColumn.Caption string is taken into account for Excel's column names instead of DataColumn.ColumnName.
However, if the exported DataTable has no rows, the DataColumnCaption field is not taken into account and DataColumn.ColumnName is used.
I believe it would be nice to have the same behaviour for column names for both cases.
Steps to reproduce:
1. Create a DataTable with no rows but with some DataColumns.
2. Fill the DataColumn.Caption field with some non-whitespace string
3. Export the DataTable with worksheet.Cell("A1").InsertTable(dataTable);
However, if the exported DataTable has no rows, the DataColumnCaption field is not taken into account and DataColumn.ColumnName is used.
I believe it would be nice to have the same behaviour for column names for both cases.
Steps to reproduce:
1. Create a DataTable with no rows but with some DataColumns.
2. Fill the DataColumn.Caption field with some non-whitespace string
3. Export the DataTable with worksheet.Cell("A1").InsertTable(dataTable);