Spread Windows Forms 6.0 Product Documentation
ClearRange Method
See Also  Example Support Options
FarPoint.Win.Spread Assembly > FarPoint.Win.Spread Namespace > SheetView Class : ClearRange Method


Glossary Item Box

Removes all of the data, formatting, formulas, and notes from a range of cells on this sheet.

Overload List

OverloadDescription
ClearRange(Int32,Int32,Int32,Int32,Boolean)Removes all of the data, formatting, formulas, and notes from a range of cells on this sheet.  
ClearRange(Int32,Int32,Int32,Int32,Boolean,ClipboardCopyOptions)Removes all of the data, formatting, formulas, and notes from a range of cells on this sheet.  

Remarks

If you set the dataOnly parameter to true, the method clears the formulas, the cell notes, and the text in the cells in that range; in other words, it clears all the information that is in the data model for those cells.

Example

This example removes all the data, formatting, formulas, and notes from a range of cells.
C#Copy Code
Random r = new Random();
int i, j;
DialogResult dlg;
for (i = 0; i <= 3; i++)
{
    for (j = 0; j <= 3; j++)
    {
        fpSpread1.ActiveSheet.SetValue(i, j, r.Next() -100000);
    }
}
fpSpread1.ActiveSheet.SetFormula(5, 0, "Sum(A1, B2)");
fpSpread1.ActiveSheet.SetNote(5, 3, fpSpread1.ActiveSheet.Cells[2, 2].Text);
dlg = MessageBox.Show("Do you want to clear the range?", "ClearRange", MessageBoxButtons.YesNo);
if (dlg == DialogResult.Yes)
{
    fpSpread1.ActiveSheet.ClearRange(0, 0, 6, 6);
}
Visual BasicCopy Code
Dim r As New Random()
Dim i, j As Integer
Dim dlg As DialogResult
For i = 0 To 3
    For j = 0 To 3
        FpSpread1.ActiveSheet.SetValue(i, j, r.Next - 100000.ToString())
    Next j
Next i
FpSpread1.ActiveSheet.SetFormula(5, 0, "Sum(A1, B2)")
FpSpread1.ActiveSheet.SetNote(5, 3, FpSpread1.ActiveSheet.Cells(2, 2).Text)
dlg = MessageBox.Show("Do you want to clear the range?", "ClearRange", MessageBoxButtons.YesNo)
If dlg = DialogResult.Yes Then
    FpSpread1.ActiveSheet.ClearRange(0, 0, 6, 6)
End If

Requirements

Target Platforms: Windows 7, 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

See Also

© 2002-2012 ComponentOne, a division of GrapeCity. All Rights Reserved.