'Declaration Public Overloads Function FormatAsTable( _ ByVal tableHasHeaders As Boolean, _ ByVal tableStyle As WorksheetTableStyle _ ) As WorksheetTable
public WorksheetTable FormatAsTable( bool tableHasHeaders, WorksheetTableStyle tableStyle )
Exception | Description |
---|---|
System.ArgumentException | The specified tableStyle does not exist in the CustomTableStyles or StandardTableStyles collections. |
System.InvalidOperationException | The region contains one or more cells from another WorksheetTable. |
System.InvalidOperationException | The region contains one or more cells which have a multi-cell ArrayFormula applied. |
System.InvalidOperationException | The region contains one or more cells which are part of a WorksheetDataTable. |
When the table is created, the specified tableStyle will be applied to the value.
When the table is created, the column names will be taken from the cells in the header row if tableHasHeaders is True. If it is False, the column names will be generated and the cells for the header row will be inserted into the worksheet.
The column names are unique within the owning WorksheetTable. If, when the table is created, there are two or more columns with the same name, the second and subsequent duplicate column names will have a number appended to make them unique. If any cells in the header row have a non-string value, their value will be changed to a string (the current display text of the cell). If any cells in the header row have no value, they will be given a generated column name.
If the region partially contains any merged cell regions, they will be removed from the worksheet and the table region will be expanded to include all cells from the merged region.
Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2