GrapeCity.Xaml.SpreadSheet.Data
AddSelection(Int32,Int32,Int32,Int32,Boolean) Method
Example 


The row index of the first cell to add.
The column index of the first cell to add.
The number of rows to add.
The number of columns to add.
Whether to reset the anchor cell to the top-left corner of the selection area.
Adds a cell or cells to the selection.
Syntax
'Declaration
 
Public Overloads Sub AddSelection( _
   ByVal row As Integer, _
   ByVal column As Integer, _
   ByVal rowCount As Integer, _
   ByVal columnCount As Integer, _
   ByVal moveAnchorCell As Boolean _
) 
'Usage
 
Dim instance As Worksheet
Dim row As Integer
Dim column As Integer
Dim rowCount As Integer
Dim columnCount As Integer
Dim moveAnchorCell As Boolean
 
instance.AddSelection(row, column, rowCount, columnCount, moveAnchorCell)
public void AddSelection( 
   int row,
   int column,
   int rowCount,
   int columnCount,
   bool moveAnchorCell
)

Parameters

row
The row index of the first cell to add.
column
The column index of the first cell to add.
rowCount
The number of rows to add.
columnCount
The number of columns to add.
moveAnchorCell
Whether to reset the anchor cell to the top-left corner of the selection area.
Example
This example uses the AddSelection method.
        GrapeCity.Xaml.SpreadSheet.Data.CellRange cellr = new GrapeCity.Xaml.SpreadSheet.Data.CellRange(0, 0, 3, 3);
        GrapeCity.Xaml.SpreadSheet.Data.CellRange cellr2 = new GrapeCity.Xaml.SpreadSheet.Data.CellRange(4, 0, 2, 2);
        gcSpreadSheet1.Sheets[0].SelectionPolicy = GrapeCity.Xaml.SpreadSheet.Data.SelectionPolicy.MultiRange;
        //gcSpreadSheet1.Sheets[0].SetSelection(0, 0, 3, 3);
        gcSpreadSheet1.Sheets[0].SetSelection(cellr);
        //gcSpreadSheet1.Sheets[0].AddSelection(4, 0, 2, 2);
        //gcSpreadSheet1.Sheets[0].AddSelection(cellr2);
        gcSpreadSheet1.Sheets[0].AddSelection(cellr2, true);
        //gcSpreadSheet1.Sheets[0].AddSelection(4, 0, 2, 2, true);
        //Specifies the extent (or farthest cell) in the selection of cells.
        gcSpreadSheet1.Sheets[0].ExtendSelection(6, 3);

private void button1_Click(object sender, RoutedEventArgs e)
        {
         GrapeCity.Xaml.SpreadSheet.Data.CellRange cellr3 = new GrapeCity.Xaml.SpreadSheet.Data.CellRange(0, 0, 3, 3);
        listBox1.Items.Add(gcSpreadSheet1.Sheets[0].IsAnyCellInColumnSelected(0).ToString());
        listBox1.Items.Add(gcSpreadSheet1.Sheets[0].IsAnyCellInRowSelected(10).ToString());
        listBox1.Items.Add(gcSpreadSheet1.Sheets[0].IsSelected(3, 3).ToString());
        //gcSpreadSheet1.Sheets[0].ClearSelections();
        //gcSpreadSheet1.Sheets[0].ClearSelection(0, 0, 3, 3);
        //gcSpreadSheet1.Sheets[0].ClearSelection(cellr3);        
        }
        Dim cellr As New GrapeCity.Xaml.SpreadSheet.Data.CellRange(0, 0, 3, 3)
        Dim cellr2 As New GrapeCity.Xaml.SpreadSheet.Data.CellRange(4, 0, 2, 2)
        GcSpreadSheet1.Sheets(0).SelectionPolicy = GrapeCity.Xaml.SpreadSheet.Data.SelectionPolicy.MultiRange
        'GcSpreadSheet1.Sheets(0).SetSelection(0, 0, 3, 3)
        GcSpreadSheet1.Sheets(0).SetSelection(cellr)
        'GcSpreadSheet1.Sheets(0).AddSelection(4, 0, 2, 2)
        'GcSpreadSheet1.Sheets(0).AddSelection(cellr2)
        GcSpreadSheet1.Sheets(0).AddSelection(cellr2, True)
        'GcSpreadSheet1.Sheets(0).AddSelection(4, 0, 2, 2, True)
        'Specifies the extent (or farthest cell) in the selection of cells.
        GcSpreadSheet1.Sheets(0).ExtendSelection(6, 3)

Private Sub Button_Click_1(sender As Object, e As RoutedEventArgs)
        Dim cellr3 As New GrapeCity.Xaml.SpreadSheet.Data.CellRange(0, 0, 3, 3)
        ListBox1.Items.Add(gcSpreadSheet1.Sheets(0).IsAnyCellInColumnSelected(0).ToString())
        ListBox1.Items.Add(gcSpreadSheet1.Sheets(0).IsAnyCellInRowSelected(10).ToString())
        ListBox1.Items.Add(gcSpreadSheet1.Sheets(0).IsSelected(3, 3).ToString())
        'GcSpreadSheet1.Sheets(0).ClearSelections()
        'GcSpreadSheet1.Sheets(0).ClearSelection(0, 0, 3, 3)
        'GcSpreadSheet1.Sheets(0).ClearSelection(cellr3)
    End Sub
Requirements

Target Platforms: Windows Server 2012, Windows RT

See Also

Reference

Worksheet Class
Worksheet Members
Overload List

 

 


Copyright © GrapeCity, inc. All rights reserved.

Support Options