Version

GetCellValue(Int32) Method

Gets the value of the cell at the specified column index.
Syntax
'Declaration
 
Public Function GetCellValue( _
   ByVal columnIndex As Integer _
) As Object
public object GetCellValue( 
   int columnIndex
)

Parameters

columnIndex
The 0-based index of the cell within the WorksheetRow.
Exceptions
ExceptionDescription
System.ArgumentOutOfRangeExceptioncolumnIndex is less than zero or greater than or equal to the number of columns in the worksheet.
System.InvalidOperationExceptionIf the row was removed from the worksheet.
Remarks

If this cell belongs to a merged cell region and it is the top-left cell of the region, getting and setting the value will get and set the value of the associated merged cell region. Getting the value of other cells in a merged cell region will always return null. Setting the value of other cells in a merged cell region will have no effect.

If a formula has been applied to the cell or a data table is associated with the cell, getting the Value will return the calculated value of the cell.

The types supported for the value are:

  • System.Byte
  • System.SByte
  • System.Int16
  • System.Int64
  • System.UInt16
  • System.UInt64
  • System.UInt32
  • System.Int32
  • System.Single
  • System.Double
  • System.Boolean
  • System.Char
  • System.Enum
  • System.Decimal
  • System.DateTime
  • System.String
  • System.Text.StringBuilder
  • System.DBNull
  • ErrorValue
  • FormattedString

Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, 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