Quantcast
Channel: Excel Data Reader - Read Excel files in .NET
Viewing all articles
Browse latest Browse all 448

Commented Unassigned: Default name for columns with no name [12857]

$
0
0
I have a .xlsx file where only some of the columns in row 1 has names. The columns with no name is automatically named 'Column?' (This is both Caption and ColumnName).
I have previously used Excel by opening as a database via oledb and where these columns were automatically named 'F?'. No I have a backward compatibility problem because of this.
This is giving me problems as I do not feel I can just rename Column? to F? because I cannot seem to differentiate between a column actually named Column2 and one which was internally named Column2 because no name is specified in the spreadsheet.

So basically I have two questions;
1. Is is possible to change the default behavior of this auto naming of columns with no name? Basically exchange 'Column' with 'F'
2. Or is possible to tell if column didn't actually have a name (was blank). Then I can write the logic myself.

Thanks in advance :)

Ok, after reading the documentation I created a patch with the id; 16126. Hopefully it will accepted as my issue is now resolved by it.

REVIEW patch and apply if appropriate
Comments: ** Comment from web user: bleze **

It turns out that this patch is not enough to get the correct behavior.

The column index starts at 0 and I need it to start at 1.

I've found 3 places in the code where the column name is handled;

Helpers.AddColumnHandleDuplicate(table, string.Concat(COLUMN, i));

I've added a backward compatible bool setting for changing this index behavior. Attached is rev. 2 of the patch.


Viewing all articles
Browse latest Browse all 448

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>