AutoFillTable
(
Microsoft.Office.Interop.Excel.Workbook oWorkbook,
AutoFillUserSettings oAutoFillUserSettings,
AutoFillWorkbookResults oAutoFillWorkbookResults,
String sWorksheetName,
String sTableName,
AutoFillTableMethod oAutoFillTableMethod
)
{
Debug.Assert(oWorkbook != null);
Debug.Assert(oAutoFillUserSettings != null);
Debug.Assert(oAutoFillWorkbookResults != null);
Debug.Assert( !String.IsNullOrEmpty(sWorksheetName) );
Debug.Assert( !String.IsNullOrEmpty(sTableName) );
Debug.Assert(oAutoFillTableMethod != null);
ListObject oTable;
ExcelHiddenColumns oHiddenColumns;
if (ExcelTableUtil.TryGetTable(oWorkbook, sWorksheetName, sTableName,
out oTable) )
{
// The TableColumnMapper class that does the actual autofilling
// fills only visible cells. Temporarily show all hidden columns
// in the table.
oHiddenColumns = ExcelColumnHider.ShowHiddenColumns(oTable);
try
{
oAutoFillTableMethod(oTable, oAutoFillUserSettings,
oAutoFillWorkbookResults);
}
finally
{
ExcelColumnHider.RestoreHiddenColumns(oTable, oHiddenColumns);
}
}
}