GetTableColumnIndex
(
ListObject oTable,
String sColumnName,
Boolean bColumnIsRequired
)
{
Debug.Assert(oTable != null);
Debug.Assert(!String.IsNullOrEmpty(sColumnName));
AssertValid();
ListColumn oColumn;
if (ExcelTableUtil.TryGetTableColumn(oTable, sColumnName, out oColumn))
{
return(oColumn.Index);
}
if (bColumnIsRequired)
{
OnWorkbookFormatError(String.Format(
"The table named \"{0}\" must have a column named \"{1}.\""
+ "\r\n\r\n{2}"
,
oTable.Name,
sColumnName,
ErrorUtil.GetTemplateMessage()
));
}
return(NoSuchColumn);
}