Spread Windows Forms 10.0 Product Documentation
FillRange(Int32,Int32,Int32,Int32,Int32,FillDirection) Method
Example 


Row index of the starting cell in the range to copy
Column index of the starting cell in the range to copy
Number of rows in the range to copy
Number of columns in the range to copy
Number of rows or columns into which to copy the specified range
Direction of fill (to copy the specified range)
Fills a range of cells on this sheet by copying a specified range in the specified direction.
Syntax
'Declaration
 
Public Overloads Sub FillRange( _
   ByVal row As Integer, _
   ByVal column As Integer, _
   ByVal rowCount As Integer, _
   ByVal columnCount As Integer, _
   ByVal fillCount As Integer, _
   ByVal fillDirection As FillDirection _
) 
'Usage
 
Dim instance As SheetView
Dim row As Integer
Dim column As Integer
Dim rowCount As Integer
Dim columnCount As Integer
Dim fillCount As Integer
Dim fillDirection As FillDirection
 
instance.FillRange(row, column, rowCount, columnCount, fillCount, fillDirection)
public void FillRange( 
   int row,
   int column,
   int rowCount,
   int columnCount,
   int fillCount,
   FillDirection fillDirection
)

Parameters

row
Row index of the starting cell in the range to copy
column
Column index of the starting cell in the range to copy
rowCount
Number of rows in the range to copy
columnCount
Number of columns in the range to copy
fillCount
Number of rows or columns into which to copy the specified range
fillDirection
Direction of fill (to copy the specified range)
Exceptions
ExceptionDescription
System.ArgumentOutOfRangeException Specified row index is not valid; must be between -1 and the total number of rows
System.ArgumentOutOfRangeException Specified column index is not valid; must be between -1 and the total number of columns
System.ArgumentOutOfRangeException Specified row count is not valid; must be -1 or between 0 and the total number of rows minus the current row index
System.ArgumentOutOfRangeException Specified column count is not valid; must be -1 or between 0 and the total number of columns minus the current column index
System.ArgumentOutOfRangeException Specified number of rows or columns (fill count) is not valid; must be -1 or between 0 and the total number of rows or columns
System.ComponentModel.InvalidEnumArgumentException Specified direction of the fill is not valid; must be one of the allowed enumeration settings
Remarks
The default behavior is to copy all cell settings; to fill only the data, use the other overload and specify true for the dataOnly parameter.
Example
This example fills a range of cells with data and styles.
//  Define the text to repeat.
fpSpread1.ActiveSheet.Cells[0, 0].Text = "A1-text";
fpSpread1.ActiveSheet.Cells[0, 1].Text = "A2-text";
fpSpread1.ActiveSheet.Cells[1, 0].Text = "B1-text";
fpSpread1.ActiveSheet.Cells[1, 1].Text = "B2-text";

fpSpread1.ActiveSheet.Cells[0, 0].BackColor = Color.Cyan;
fpSpread1.ActiveSheet.Cells[0, 0].ForeColor = Color.DarkBlue;
fpSpread1.ActiveSheet.Cells[0, 1].BackColor = Color.Coral;
fpSpread1.ActiveSheet.Cells[0, 1].ForeColor = Color.DarkRed;

// Fill three more columns to the right with the two columns' contents.
fpSpread1.ActiveSheet.FillRange(0, 1, 2, 1, 3, FillDirection.Right);

// Fill four more rows down with the contents of the square 
//  of two rows and two columns.
fpSpread1.ActiveSheet.FillRange(0, 0, 2, 2, 4, FillDirection.Down);


' Define the text to repeat.
fpSpread1.ActiveSheet.Cells(0, 0).Text = "A1-text"
fpSpread1.ActiveSheet.Cells(0, 1).Text = "A2-text"
fpSpread1.ActiveSheet.Cells(1, 0).Text = "B1-text"
fpSpread1.ActiveSheet.Cells(1, 1).Text = "B2-text"

fpSpread1.ActiveSheet.Cells(0, 0).BackColor = Color.Cyan
fpSpread1.ActiveSheet.Cells(0, 0).ForeColor = Color.DarkBlue
fpSpread1.ActiveSheet.Cells(0, 1).BackColor = Color.Coral
fpSpread1.ActiveSheet.Cells(0, 1).ForeColor = Color.DarkRed

' Fill three more columns to the right with the two columns' contents.
fpSpread1.ActiveSheet.FillRange(0, 1, 2, 1, 3, FillDirection.Right)

' Fill four more rows down with the contents of the square 
'  of two rows and two columns.
fpSpread1.ActiveSheet.FillRange(0, 0, 2, 2, 4, FillDirection.Down)

Requirements

Target Platforms: Windows 2000 Professional (SP4), Windows 2000 Server, Windows 2003 Server (SP1), Windows Server 2012 R2, Windows 2008, Windows XP (SP2), Windows Vista, Windows 7, Windows 8, Windows 8.1, Windows 10

See Also

Reference

SheetView Class
SheetView Members
Overload List

 

 


Copyright © GrapeCity, inc. All rights reserved.