See Also

IRange Interface  | IRange Members  | Overload List  | Item(String) Property  | Item(Int32,Int32) Property

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

Language

Visual Basic

C#

C++

C++/CLI

Show All

row1Offset
The offset for the top row of the new range (may be negative).
column1Offset
The offset for the left column of the new range (may be negative).
row2Offset
The offset for the bottom row of the new range (may be negative).
column2Offset
The offset for the right column of the new range (may be negative).
See Also Languages SpreadsheetGear The Performance Spreadsheet Component Company 

Item(Int32,Int32,Int32,Int32) Property

SpreadsheetGear Namespace > IRange Interface > Item Property : Item(Int32,Int32,Int32,Int32) Property

Returns a new 2d range instance of IRange which is offset from the top-left cell of the current range by the specified starting and ending row and column offsets.

[Visual Basic]
Overloads Overridable ReadOnly Property Item( _    ByVal row1Offset As Integer, _    ByVal column1Offset As Integer, _    ByVal row2Offset As Integer, _    ByVal column2Offset As Integer _ ) As IRange
[C#]
virtual IRange Item(    int row1Offset,    int column1Offset,    int row2Offset,    int column2Offset ); {get;}
[C++]
__property virtual IRange* get_Item(    int row1Offset,    int column1Offset,    int row2Offset,    int column2Offset );
[C++/CLI]
virtual property IRange^ Item {    IRange^ get(int row1Offsetint column1Offsetint row2Offsetint column2Offset); }

Parameters

row1Offset
The offset for the top row of the new range (may be negative).
column1Offset
The offset for the left column of the new range (may be negative).
row2Offset
The offset for the bottom row of the new range (may be negative).
column2Offset
The offset for the right column of the new range (may be negative).

Example

[C#] 

class Program 

    static void Main() 
    { 
        // Create a workbook. 
        SpreadsheetGear.IWorkbook workbook = SpreadsheetGear.Factory.GetWorkbook(); 
        // Get the worksheet and change the name. 
        SpreadsheetGear.IWorksheet worksheet = workbook.Worksheets["Sheet1"]; 
        worksheet.Name = "2005 Sales"; 
        // Get the worksheet cells reference. 
        SpreadsheetGear.IRange cells = worksheet.Cells; 
        // Add column headers using a string index into the cell range. 
        cells["B1"].Formula = "Jan"; 
        cells["C1"].Formula = "Feb"; 
        cells["D1"].Formula = "Mar"; 
        // Add row headers using zero based row and column indexes. 
        cells[1, 0].Formula = "Jennifer"; 
        cells[2, 0].Formula = "William"; 
        cells[3, 0].Formula = "Kristen"; 
        // Add random data using a multiple cell string index. 
        cells["B2:D4"].Formula = "=RAND()*10000"; 
        // Center the column headers using multiple cell row and column indexes. 
        cells[0, 1, 0, 3].HorizontalAlignment = SpreadsheetGear.HAlign.Center; 
        // Bold the row and column headers using a string index to multiple ranges. 
        cells["B1:D1,A2:A4"].Font.Bold = true; 
        // Format the data as currency. 
        cells["B2:D4"].NumberFormat = "$#,##0"; 
        // Write the workbook. 
        workbook.SaveAs("2005 Sales.xls", SpreadsheetGear.FileFormat.XLS97); 
    } 

    

[Visual Basic] 

Class Program
    Shared Sub Main()
        ' Create a workbook.
        Dim workbook As SpreadsheetGear.IWorkbook = SpreadsheetGear.Factory.GetWorkbook()
        ' Get the worksheet and change the name.
        Dim worksheet As SpreadsheetGear.IWorksheet = workbook.Worksheets("Sheet1")
        worksheet.Name = "2005 Sales"
        ' Get the worksheet cells reference.
        Dim cells As SpreadsheetGear.IRange = worksheet.Cells
        ' Add column headers using a string index into the cells range.
        cells("B1").Formula = "Jan"
        cells("C1").Formula = "Feb"
        cells("D1").Formula = "Mar"
        ' Add row headers using zero based row and column indexes.
        cells(1, 0).Formula = "Jennifer"
        cells(2, 0).Formula = "William"
        cells(3, 0).Formula = "Kristen"
        ' Add random data using a multiple cell string index.
        cells("B2:D4").Formula = "=RAND()*10000"
        ' Center the column headers using multiple cell row and column indexes.
        cells(0, 1, 0, 3).HorizontalAlignment = SpreadsheetGear.HAlign.Center
        ' Bold the row and column headers using a string index to multiple ranges.
        cells("B1:D1,A2:A4").Font.Bold = True
        ' Format the data as currency.
        cells("B2:D4").NumberFormat = "$#,##0"
        ' Write the workbook.
        workbook.SaveAs("2005 Sales.xls", SpreadsheetGear.FileFormat.XLS97)
    End Sub 'Main
End Class 'Program

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

IRange Interface  | IRange Members  | Overload List  | Item(String) Property  | Item(Int32,Int32) Property

 

 


See our live Excel Reporting, Excel Charting, Excel to DataGrid and Excel Calculation Samples.

Copyright © 2003-2007 SpreadsheetGear LLC. All Rights Reserved.

SpreadsheetGear and Spreadsheet Gear are trademarks of SpreadsheetGear LLC.