This project has moved and is read-only. For the latest updates, please go here.

Table/range: how to check if contains column?

Jan 7, 2015 at 10:53 AM
I want to check if a table contains column with specific name,
But getting exception when accessing not existing column.
Is there some way?

var tableMData = dataRange.AsTable();
if (tableMData.DataRange.Column("column name") == null)

. Specified argument was out of the range of valid values. Parameter name: The header row doesn't contain field name 'xxx'. at ClosedXML.Excel.XLTable.GetFieldIndex(String name) at ClosedXML.Excel.XLTableRange