Skip to main content
A newer version of this page is available. .
.NET Framework 4.5.2+
Row

TableStyleElement.Clear() Method

Removes existing formatting from the table style element.

Namespace: DevExpress.Spreadsheet

Assembly: DevExpress.Spreadsheet.v19.1.Core.dll

Declaration

void Clear()

Example

You can create new custom table styles based on existing table styles (for example, based on built-in table styles). To do this, use the TableStyle.Duplicate method. This method creates a copy of the specified style and returns the TableStyle object representing the newly created style. You can use properties of this object to change the style format settings.

For example, the code snippet below demonstrates how to duplicate an existing style and modify the new style a bit by removing the table header row formatting copied from the source table style.

Note

A complete sample project is available at https://github.com/DevExpress-Examples/how-to-format-tables-e4909

Private Function DuplicateAndModifyTableStyle(ByVal workbook As IWorkbook, ByVal sourceStyleName As String) As TableStyle
    ' Get the table style to be duplicated.
    Dim sourceTableStyle As TableStyle = workbook.TableStyles(sourceStyleName)

    ' Duplicate the table style.
    Dim newTableStyle As TableStyle = sourceTableStyle.Duplicate()

    ' Modify the required formatting characteristics of the created table style.
    ' For example, remove exisitng formatting from the header row element.
    newTableStyle.TableStyleElements(TableStyleElementType.HeaderRow).Clear()

    Return newTableStyle
End Function

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the Clear() method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also