'Declaration Public Sub SetCellValue( _ ByVal columnIndex As System.Integer, _ ByVal value As System.Object _ )
public void SetCellValue( System.int columnIndex, System.object value )
Exception | Description |
---|---|
System.ArgumentOutOfRangeException | columnIndex is less than zero or greater than or equal to the number of columns in the worksheet. |
System.NotSupportedException | The assigned value's type is not supported and can't be exported to Excel. |
System.InvalidOperationException | The value assigned is a Formula. Instead, Formula.ApplyTo should be called on the Formula, passing in the cell. |
System.InvalidOperationException | The value assigned is a WorksheetDataTable. Instead, the CellsInTable should be set to a region containing the cell. |
System.InvalidOperationException | The value assigned is a FormattedString which is the value another cell or merged cell region. |
System.InvalidOperationException | The value is assigned and this cell is part of an ArrayFormula or WorksheetDataTable. |
System.InvalidOperationException | If the row was removed from the worksheet. |
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:
Target Platforms: Windows 8.1, Windows 8.1, Windows 8, 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
View on GitHub