SpreadsheetGear 2023
Item(Int32,Int32) Property
Example 


SpreadsheetGear Namespace > IRange Interface > Item Property : Item(Int32,Int32) Property
The offset for the row of the new range (may be negative).
The offset for the column of the new range (may be negative).
Returns a new single cell instance of IRange which is offset from the top-left cell of the current IRange.
Syntax
'Declaration
 
Overloads ReadOnly Property Item( _
   ByVal rowOffset As System.Integer, _
   ByVal columnOffset As System.Integer _
) As IRange
'Usage
 
Dim instance As IRange
Dim rowOffset As System.Integer
Dim columnOffset As System.Integer
Dim value As IRange
 
value = instance.Item(rowOffset, columnOffset)
IRange Item( 
   System.int rowOffset,
   System.int columnOffset
) {get;}

Parameters

rowOffset
The offset for the row of the new range (may be negative).
columnOffset
The offset for the column of the new range (may be negative).
Example
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.Excel8);
    }
}
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.Excel8)
    End Sub 'Main
End Class 'Program
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

Reference

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