Cell Class
Encapsulates the object that represents a single Workbook cell.
Inheritance Hierarchy
SystemObject
  Aspose.CellsCell

Namespace: Aspose.Cells
Assembly: Aspose.Cells (in Aspose.Cells.dll) Version: 19.11.0.0 (19.11)
Syntax
public class Cell

The Cell type exposes the following members.

Properties
  NameDescription
Public propertyBoolValue
Gets the boolean value contained in the cell.
Public propertyColumn
Gets column number (zero based) of the cell.
Public propertyContainsExternalLink
Indicates whether this cell contains an external link. Only applies when the cell is a formula cell.
Public propertyDateTimeValue
Gets the DateTime value contained in the cell.
Public propertyDisplayStringValue
Gets the formatted string value of this cell.
Public propertyDoubleValue
Gets the double value contained in the cell.
Public propertyFloatValue
Gets the float value contained in the cell.
Public propertyCode exampleFormula
Gets or sets a formula of the Cell.
Public propertyFormulaLocal
Get the locale formatted formula of the cell.
Public propertyHtmlString
Gets and sets the html string which contains data and some formats in this cell.
Public propertyIntValue
Gets the integer value contained in the cell.
Public propertyIsArrayFormula
Indicates whether the cell formula is an array formula.
Public propertyIsArrayHeader
Inidicates the cell's formula is and array formula and it is the first cell of the array.
Public propertyIsErrorValue
Checks if a formula can properly evaluate a result.
Public propertyIsFormula
Represents if the specified cell contains formula.
Public propertyIsInArray Obsolete.
Indicates whether the cell formula is an array formula.
Public propertyIsInTable Obsolete.
Indicates whether this cell is part of table formula.
Public propertyIsMerged
Checks if a cell is part of a merged range or not.
Public propertyIsSharedFormula
Indicates whether the cell formula is part of shared formula.
Public propertyIsStyleSet
Indicates if the cell's style is set. If return false, it means this cell has a default cell format.
Public propertyIsTableFormula
Indicates whether this cell is part of table formula.
Public propertyName
Gets the name of the cell.
Public propertyNumberCategoryType
Represents the category type of this cell's number formatting.
Public propertyR1C1Formula
Gets or sets a R1C1 formula of the Cell.
Public propertyRow
Gets row number (zero based) of the cell.
Public propertySharedStyleIndex
Gets cell's shared style index in the style pool.
Public propertyStringValue
Gets the string value contained in the cell. If the type of this cell is string, then return the string value itself. For other cell types, the formatted string value (formatted with the specified style of this cell) will be returned. The formatted cell value is same with what you can get from excel when copying a cell as text(such as copying cell to text editor or exporting to csv).
Public propertyStringValueWithoutFormat
Gets cell's value as string without any format.
Public propertyType
Represents cell value type.
Public propertyValue
Gets the value contained in this cell.
Public propertyWorksheet
Gets the parent worksheet.
Methods
  NameDescription
Public methodCalculate(CalculationOptions)
Calcaulate the formula of the cell.
Public methodCalculate(Boolean, ICustomFunction)
Calcaulate the formula of the cell.
Public methodCode exampleCharacters
Returns a Characters object that represents a range of characters within the cell text.
Public methodCopy
Copies data from a source cell.
Public methodEquals(Object)
Checks whether this object refers to the same cell with another.
(Overrides ObjectEquals(Object).)
Public methodEquals(Cell)
Checks whether this object refers to the same cell with another cell object.
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetArrayRange
Gets the array range if the cell's formula is an array formula.
Public methodGetCharacters
Returns all Characters objects that represents a range of characters within the cell text.
Public methodGetCharacters(Boolean)
Returns all Characters objects that represents a range of characters within the cell text.
Public methodGetConditionalFormattingResult
Get the result of the conditional formatting.
Public methodGetDependents
Get all cells which refer to the specific cell.
Public methodGetDisplayStyle
Gets the display style of the cell. If the cell is conditional formatted, the display style is not same as the cell.GetStyle().
Public methodGetDisplayStyle(Boolean)
Gets the display style of the cell. If the cell is conditional formatted, the display style is not same as the cell.GetStyle().
Public methodGetFormatConditions
Gets format conditions which applies to this cell.
Public methodGetFormula
Get the formula of this cell.
Public methodGetHashCode
Serves as a hash function for a particular type.
(Overrides ObjectGetHashCode.)
Public methodGetHeightOfValue
Gets the height of the value in unit of pixels.
Public methodGetHtmlString
Gets the html string which contains data and some formats in this cell.
Public methodGetLeafs
Get all cells which will be updated when this cell is modified. This method can only work after calling Workbook.CalculateFormula.
Public methodGetMergedRange
Returns a Range object which represents a merged range.
Public methodCode exampleGetPrecedents
Gets all cells or ranges which this cell's formula depends on.
Public methodGetStringValue
Gets the string value by specific formatted strategy.
Public methodGetStyle
Gets the cell style.
Public methodGetStyle(Boolean)
If checkBorders is true, check whether other cells' borders will effect the style of this cell.
Public methodGetTable
Gets the table which contains this cell.
Public methodGetType
Gets the type of the current instance.
(Inherited from Object.)
Public methodGetValidation
Gets the validation applied to this cell.
Public methodGetValidationValue
Gets the value of validation which applied to this cell.
Public methodGetWidthOfValue
Gets the width of the value in unit of pixels.
Public methodIsRichText
Indicates whether the cell string value is a rich text.
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodPutValue(Boolean)
Puts an boolean value into the cell.
Public methodPutValue(DateTime)
Puts a DateTime value into the cell.
Public methodPutValue(Double)
Puts a double value into the cell.
Public methodPutValue(Int32)
Puts an integer value into the cell.
Public methodPutValue(Object)
Puts an object value into the cell.
Public methodPutValue(String)
Puts a string value into the cell.
Public methodPutValue(String, Boolean)
Puts a string value into the cell and converts the value to other data type if appropriate.
Public methodPutValue(String, Boolean, Boolean)
Puts a value into the cell, if appropriate the value will be converted to other data type and cell's number format will be reset.
Public methodRemoveArrayFormula
Remove array formula.
Public methodCode exampleSetAddInFormula Obsolete.
Sets an Add-In formula to the cell.
Public methodSetArrayFormula(String, Int32, Int32)
Sets an array formula to a range of cells.
Public methodSetArrayFormula(String, Int32, Int32, Boolean, Boolean)
Sets an array formula to a range of cells.
Public methodSetCharacters
Sets rich text format of the cell.
Public methodSetFormula(String, Object)
Set the formula and the value of the formula.
Public methodSetFormula(String, Boolean, Boolean, Object)
Set the formula and the value of the formula.
Public methodSetSharedFormula(String, Int32, Int32)
Sets a formula to a range of cells.
Public methodSetSharedFormula(String, Int32, Int32, Boolean, Boolean)
Sets a formula to a range of cells.
Public methodSetStyle(Style)
Sets the cell style.
Public methodSetStyle(Style, StyleFlag)
Apply the cell style.
Public methodSetStyle(Style, Boolean)
Apply the cell style.
Public methodToString
Returns a string represents the current Cell object.
(Overrides ObjectToString.)
Examples
   [C#]

   Workbook excel = new Workbook();
   Cells cells = excel.Worksheets[0].Cells;

   //Put a string into a cell
   Cell cell = cells[0, 0];
   cell.PutValue("Hello");

   string first = cell.StringValue;

   //Put an integer into a cell
   cell = cells["B1"];
   cell.PutValue(12);

   int second = cell.IntValue;

   //Put a double into a cell
   cell = cells[0, 2];
   cell.PutValue(-1.234);

   double third = cell.DoubleValue;

   //Put a formula into a cell
   cell = cells["D1"];
   cell.Formula = "=B1 + C1";

   //Put a combined formula: "sum(average(b1,c1), b1)" to cell at b2
   cell = cells["b2"];
   cell.Formula = "=sum(average(b1,c1), b1)";

   //Set style of a cell
   Style style = cell.GetStyle();
   //Set background color
   style.BackgroundColor = Color.Yellow;
   //Set format of a cell
   style.Font.Name = "Courier New";
   style.VerticalAlignment = TextAlignmentType.Top;
cell.SetStyle(style);



[Visual Basic]

   Dim excel as Workbook = new Workbook()
   Dim cells as Cells = exce.Worksheets(0).Cells

   'Put a string into a cell
   Dim cell as Cell = cells(0, 0)
   cell.PutValue("Hello")

   Dim first as String = cell.StringValue

   //Put an integer into a cell
   cell = cells("B1")
   cell.PutValue(12)

   Dim second as Integer = cell.IntValue

   //Put a double into a cell
   cell = cells(0, 2)
   cell.PutValue(-1.234)

   Dim third as Double = cell.DoubleValue

   //Put a formula into a cell
   cell = cells("D1")
   cell.Formula = "=B1 + C1"

   //Put a combined formula: "sum(average(b1,c1), b1)" to cell at b2
   cell = cells("b2")
   cell.Formula = "=sum(average(b1,c1), b1)"

   //Set style of a cell
   Dim style as Style = cell.GetStyle()

   //Set background color
   style.BackgroundColor = Color.Yellow
   //Set font of a cell
   style.Font.Name = "Courier New"
   style.VerticalAlignment = TextAlignmentType.Top
   cell.SetStyle(style)
See Also