windowsforms-15438-controls-and-libraries-spreadsheet-examples-formatting-how-to-clear-cell-formatting.md
This example demonstrates how to remove all formatting from a cell or range of cells. You can do this in one of the following ways.
Call the Worksheet.ClearFormats method with the passed object specifying the cell or cell range to be cleared.
Apply the Normal style to a cell or range of cells via the CellRange.Style property.
using DevExpress.Spreadsheet;
// ...
IWorkbook workbook = spreadsheetControl1.Document;
Worksheet worksheet = workbook.Worksheets[0];
// ...
// Call the ClearFormats method.
worksheet.ClearFormats(worksheet.Range["A1:C4"]);
// Apply the Normal style to cells.
worksheet.Cells["D6"].Style = workbook.Styles[0];
worksheet.Range["F3:H4"].Style = workbook.Styles[BuiltInStyleId.Normal];
worksheet.Rows[7].Style = workbook.Styles["Normal"];
worksheet.Columns["K"].Style = workbook.Styles.DefaultStyle;
Imports DevExpress.Spreadsheet
' ...
Dim workbook As IWorkbook = spreadsheetControl1.Document
Dim worksheet As Worksheet = workbook.Worksheets(0)
' ...
' Call the ClearFormats method.
worksheet.ClearFormats(worksheet.Range("A1:C4"))
' Apply the Normal style to cells.
worksheet.Cells("D6").Style = workbook.Styles(0)
worksheet.Range("F3:H4").Style = workbook.Styles(BuiltInStyleId.Normal)
worksheet.Rows(7).Style = workbook.Styles("Normal")
worksheet.Columns("K").Style = workbook.Styles.DefaultStyle