_QueryTable.PreserveFormatting Property
This property is True if any formatting common to the first five rows of data are applied to new rows of data in the query table. Unused cells aren’t formatted. The property is False if the last AutoFormat applied to the query table is applied to new rows of data. The default value is True (unless the query table was created in Microsoft Excel 97 and the HasAutoFormat property is True, in which case PreserveFormatting is False). Read/write Boolean.
Namespace: Microsoft.Office.Interop.Excel
Assembly: Microsoft.Office.Interop.Excel (in Microsoft.Office.Interop.Excel.dll)
Syntax
'Declaration
Property PreserveFormatting As Boolean
Get
Set
'Usage
Dim instance As _QueryTable
Dim value As Boolean
value = instance.PreserveFormatting
instance.PreserveFormatting = value
bool PreserveFormatting { get; set; }
Property Value
Type: System.Boolean
Remarks
For database query tables, the default formatting setting is xlSimple.
The new AutoFormat style is applied to the query table when the table is refreshed. The AutoFormat is reset to None whenever PreserveFormatting is set to False. As a result, any AutoFormat that’s set before PreserveFormatting is set to False and before the query table is refreshed doesn’t take effect, and the resulting query table has no formatting applied to it.