Class Cell

Class Cell

Namespace: Aspose.Cells
Assembly: Aspose.Cells.dll (25.2.0)

Encapsulates the object that represents a single Workbook cell.

public class Cell

Inheritance

objectCell

Inherited Members

object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Examples

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);
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)

Properties

BoolValue

Gets the boolean value contained in the cell.

public bool BoolValue { get; }

Property Value

bool

Column

Gets column number (zero based) of the cell.

public int Column { get; }

Property Value

int

Comment

Gets the comment of this cell.

public Comment Comment { get; }

Property Value

Comment

Remarks

If there is no comment applies to the cell, returns null.

ContainsExternalLink

Indicates whether this cell contains an external link. Only applies when the cell is a formula cell.

public bool ContainsExternalLink { get; }

Property Value

bool

DateTimeValue

Gets the DateTime value contained in the cell.

public DateTime DateTimeValue { get; }

Property Value

DateTime

DisplayStringValue

Gets the formatted string value of this cell by cell’s display style.

public string DisplayStringValue { get; }

Property Value

string

DoubleValue

Gets the double value contained in the cell.

public double DoubleValue { get; }

Property Value

double

EmbeddedImage

Gets and sets the embeddedn image in the cell.

public byte[] EmbeddedImage { get; set; }

Property Value

byte[]

FloatValue

Gets the float value contained in the cell.

public float FloatValue { get; }

Property Value

float

Formula

Gets or sets a formula of the Aspose.Cells.Cell.

public string Formula { get; set; }

Property Value

string

Examples

Workbook excel = new Workbook();
Cells cells = excel.Worksheets[0].Cells;
cells["B6"].Formula = "=SUM(B2:B5, E1) + sheet1!A1";
Dim excel As Workbook =  New Workbook() 
Dim cells As Cells =  excel.Worksheets(0).Cells 
cells("B6").Formula = "=SUM(B2:B5, E1) + sheet1!A1"

Remarks

A formula string always begins with an equal sign (=). And please always use comma(,) as parameters delimiter, such as “=SUM(A1, E1, H2)”.

FormulaLocal

Get the locale formatted formula of the cell.

public string FormulaLocal { get; set; }

Property Value

string

HasCustomStyle

Indicates whether this cell has custom style settings(different from the default one inherited from corresponding row, column, or workbook).

public bool HasCustomStyle { get; }

Property Value

bool

HtmlString

Gets and sets the html string which contains data and some formats in this cell.

public string HtmlString { get; set; }

Property Value

string

IntValue

Gets the integer value contained in the cell.

public int IntValue { get; }

Property Value

int

IsArrayFormula

Indicates whether the cell formula is an array formula.

public bool IsArrayFormula { get; }

Property Value

bool

IsArrayHeader

Indicates the cell’s formula is an array formula and it is the first cell of the array.

public bool IsArrayHeader { get; }

Property Value

bool

IsCheckBoxStyle

Indicates whether setting this cell as a check box.

public bool IsCheckBoxStyle { get; set; }

Property Value

bool

IsDynamicArrayFormula

Indicates whether the cell’s formula is dynamic array formula(true) or legacy array formula(false).

public bool IsDynamicArrayFormula { get; }

Property Value

bool

IsErrorValue

Checks if the value of this cell is an error.

public bool IsErrorValue { get; }

Property Value

bool

Remarks

Also applies to formula cell to check whether the calculated result is an error.

IsFormula

Represents if the specified cell contains formula.

public bool IsFormula { get; }

Property Value

bool

IsMerged

Checks if a cell is part of a merged range or not.

public bool IsMerged { get; }

Property Value

bool

IsNumericValue

Indicates whether the value of this cell is numeric(int, double and datetime)

public bool IsNumericValue { get; }

Property Value

bool

Remarks

Also applies to formula cell to check the calculated result

IsSharedFormula

Indicates whether the cell formula is part of shared formula.

public bool IsSharedFormula { get; }

Property Value

bool

IsStyleSet

Indicates if the cell’s style is set. If return false, it means this cell has a default cell format.

public bool IsStyleSet { get; }

Property Value

bool

IsTableFormula

Indicates whether this cell is part of table formula.

public bool IsTableFormula { get; }

Property Value

bool

Name

Gets the name of the cell.

public string Name { get; }

Property Value

string

Remarks

A cell name includes its column letter and row number. For example, the name of a cell in row 0 and column 0 is A1.

NumberCategoryType

Represents the category type of this cell’s number formatting.

public NumberCategoryType NumberCategoryType { get; }

Property Value

NumberCategoryType

Remarks

When cell’s formatting pattern is combined with conditional formatting patterns, then the returned type is corresponding to the part which is used for current value of this cell. For example, if the formatting pattern for this cell is “#,##0;(#,##0);”-";@", then when cell’s value is numeric and not 0, the returned type is Aspose.Cells.NumberCategoryType.Number; When cell’s value is 0 or not numeric value, the returned type is Aspose.Cells.NumberCategoryType.Text.

R1C1Formula

Gets or sets a R1C1 formula of the Aspose.Cells.Cell.

public string R1C1Formula { get; set; }

Property Value

string

Row

Gets row number (zero based) of the cell.

public int Row { get; }

Property Value

int

SharedStyleIndex

Gets cell’s shared style index in the style pool.

public int SharedStyleIndex { get; }

Property Value

int

StringValue

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 string StringValue { get; }

Property Value

string

Type

Represents cell value type.

public CellValueType Type { get; }

Property Value

CellValueType

Value

Gets/sets the value contained in this cell.

public object Value { get; set; }

Property Value

object

Remarks

Possible type:

null,

Boolean,

DateTime,

Double,

Integer

String.

For int value, it may be returned as an Integer object or a Double object. And there is no guarantee that the returned value will be kept as the same type of object always.

Worksheet

Gets the parent worksheet.

public Worksheet Worksheet { get; }

Property Value

Worksheet

Methods

Calculate(CalculationOptions)

Calculates the formula of the cell.

public void Calculate(CalculationOptions options)

Parameters

options CalculationOptions

Options for calculation

Characters(int, int)

Returns a Characters object that represents a range of characters within the cell text.

public FontSetting Characters(int startIndex, int length)

Parameters

startIndex int

The index of the start of the character.

length int

The number of characters.

Returns

FontSetting

Characters object.

Examples

Workbook excel = new Workbook();
Cells cells = excel.Worksheets[0].Cells;
cells["A1"].PutValue("Helloworld");
cells["A1"].Characters(5, 5).Font.IsBold = true;
cells["A1"].Characters(5, 5).Font.Color = Color.Blue;
Dim excel as Workbook = new Workbook()
Dim cells as Cells = exce.Worksheets(0).Cells
cells("A1").PutValue("Helloworld")
cells("A1").Characters(5, 5).Font.IsBold = True
cells("A1").Characters(5, 5).Font.Color = Color.Blue

Remarks

This method only works on cell with string value.

Copy(Cell)

Copies data from a source cell.

public void Copy(Cell cell)

Parameters

cell Cell

Source Aspose.Cells.Cell object.

Equals(object)

Checks whether this object refers to the same cell with another.

public override bool Equals(object obj)

Parameters

obj object

another object

Returns

bool

true if two objects refers to the same cell.

Equals(Cell)

Checks whether this object refers to the same cell with another cell object.

public bool Equals(Cell cell)

Parameters

cell Cell

another cell object

Returns

bool

true if two cell objects refers to the same cell.

GetArrayRange()

Gets the array range if the cell’s formula is an array formula.

public CellArea GetArrayRange()

Returns

CellArea

The array range.

Remarks

Only applies when the cell’s formula is an array formula

GetCharacters()

Returns all Characters objects that represents a range of characters within the cell text.

public FontSetting[] GetCharacters()

Returns

FontSetting[]

All Characters objects

GetCharacters(bool)

Returns all Characters objects that represents a range of characters within the cell text.

public FontSetting[] GetCharacters(bool flag)

Parameters

flag bool

Indicates whether applying table style to the cell if the cell is in the table.

Returns

FontSetting[]

All Characters objects

GetConditionalFormattingResult()

Get the result of the conditional formatting.

public ConditionalFormattingResult GetConditionalFormattingResult()

Returns

ConditionalFormattingResult

Remarks

Returns null if no conditional formatting is applied to this cell,

GetDependents(bool)

Get all cells whose formula references to this cell directly.

public Cell[] GetDependents(bool isAll)

Parameters

isAll bool

Indicates whether check formulas in other worksheets

Returns

Cell[]

Examples

Workbook workbook = new Workbook();
Cells cells = workbook.Worksheets[0].Cells;
cells["A1"].Formula = "=B1+SUM(B1:B10)+[Book1.xls]Sheet1!B2";
cells["A2"].Formula = "=IF(TRUE,B2,B1)";
Cell[] dependents = cells["B1"].GetDependents(true);
for (int i = 0; i < dependents.Length; i++)
{
     Console.WriteLine(dependents[i].Name);
}</code></pre>

#### Remarks

<ul>
<li>If one reference containing this cell appears in one cell's formula, that cell will be taken as
        the dependent of this cell, no matter the reference or this cell is used or not while calculating.
        For example, although cell A2 in formula "=IF(TRUE,A1,A2)" is not used while calculating,
        this formula is still be taken as A2's dependent.
        </li>
<li>To get those formulas whose calculated results depend on this cell, please use Aspose.Cells.Cell.GetDependentsInCalculation(System.Boolean).</li>
<li>When tracing dependents for one cell, all formulas in the workbook or worksheet will be analized and checked.
        So it is a time consumed process. If user need to trace dependents for lots of cells, using this method will
        cause poor performance. For performance consideration, user should use Aspose.Cells.Cell.GetDependentsInCalculation(System.Boolean) instead.
        Or, user may gather precedents map of all cells by Aspose.Cells.Cell.GetPrecedents firstly,
        and then build the dependents map according to the precedents map.</li>
</ul>

### <a id="Aspose_Cells_Cell_GetDependentsInCalculation_System_Boolean_"></a> GetDependentsInCalculation\(bool\)

Gets all cells whose calculated result depends on this cell.

```csharp
public IEnumerator GetDependentsInCalculation(bool recursive)

Parameters

recursive bool

Whether returns those dependents which do not reference to this cell directly but reference to other leafs of this cell

Returns

IEnumerator

Enumerator to enumerate all dependents(Cell objects)

Examples

csharp
[C#]

Workbook workbook = new Workbook();
Cells cells = workbook.Worksheets[0].Cells;
cells["A1"].Formula = "=B1+SUM(B1:B10)+[Book1.xls]Sheet1!B2";
cells["A2"].Formula = "=IF(TRUE,B2,B1)";
workbook.Settings.FormulaSettings.EnableCalculationChain = true;
workbook.CalculateFormula();
IEnumerator en = cells["B1"].GetDependentsInCalculation(false);
Console.WriteLine("B1's calculation dependents:");
while(en.MoveNext())
{
    Cell c = (Cell)en.Current;
    Console.WriteLine(c.Name);
}
en = cells["B2"].GetDependentsInCalculation(false);
Console.WriteLine("B2's calculation dependents:");
while(en.MoveNext())
{
    Cell c = (Cell)en.Current;
    Console.WriteLine(c.Name);
}

Remarks

To use this method, please make sure the workbook has been set with true value for Aspose.Cells.FormulaSettings.EnableCalculationChain and has been fully calculated with this setting. If there is no formula reference to this cell, null will be returned.

GetDisplayStyle()

Gets the display style of the cell. If this cell is also affected by other settings such as conditional formatting, list objects, etc., then the display style may be different from cell.GetStyle().

public Style GetDisplayStyle()

Returns

Style

GetDisplayStyle(bool)

Gets the display style of the cell. If the cell is conditional formatted, the display style is not same as the cell.GetStyle().

public Style GetDisplayStyle(bool includeMergedBorders)

Parameters

includeMergedBorders bool

Indicates whether checking borders of the merged cells.

Returns

Style

GetFormatConditions()

Gets format conditions which applies to this cell.

public FormatConditionCollection[] GetFormatConditions()

Returns

FormatConditionCollection[]

Returns Aspose.Cells.FormatConditionCollection object

GetFormula(bool, bool)

Get the formula of this cell.

public string GetFormula(bool isR1C1, bool isLocal)

Parameters

isR1C1 bool

Whether the formula needs to be formatted as R1C1.

isLocal bool

Whether the formula needs to be formatted by locale.

Returns

string

the formula of this cell.

GetHashCode()

Serves as a hash function for a particular type.

public override int GetHashCode()

Returns

int

A hash code for current Cell object.

GetHeightOfValue()

Gets the height of the value in unit of pixels.

public int GetHeightOfValue()

Returns

int

GetHtmlString(bool)

Gets the html string which contains data and some formats in this cell.

public string GetHtmlString(bool html5)

Parameters

html5 bool

Indicates whether the value is compatible for html5

Returns

string

GetMergedRange()

Returns a Aspose.Cells.Range object which represents a merged range.

public Range GetMergedRange()

Returns

Range

Aspose.Cells.Range object. Null if this cell is not merged.

GetPrecedents()

Gets all references appearing in this cell’s formula.

public ReferredAreaCollection GetPrecedents()

Returns

ReferredAreaCollection

Collection of all references appearing in this cell’s formula.

Examples

csharp
[C#]

Workbook workbook = new Workbook();
Cells cells = workbook.Worksheets[0].Cells;
cells["A1"].Formula = "=B1+SUM(B1:B10)+[Book1.xls]Sheet1!A1";
ReferredAreaCollection areas = cells["A1"].GetPrecedents();
for (int i = 0; i &lt; areas.Count; i++)
{
     ReferredArea area = areas[i];
     StringBuilder stringBuilder = new StringBuilder();
     if (area.IsExternalLink)
     {
         stringBuilder.Append("[");
         stringBuilder.Append(area.ExternalFileName);
         stringBuilder.Append("]");
     }
     stringBuilder.Append(area.SheetName);
     stringBuilder.Append("!");
     stringBuilder.Append(CellsHelper.CellIndexToName(area.StartRow, area.StartColumn));
     if (area.IsArea)
     {
         stringBuilder.Append(":");
         stringBuilder.Append(CellsHelper.CellIndexToName(area.EndRow, area.EndColumn));
     }
     Console.WriteLine(stringBuilder.ToString());
}
Dim workbook As Workbook = New Workbook()
Dim cells As Cells = workbook.Worksheets(0).Cells
cells("A1").Formula = "= B1 + SUM(B1:B10) + [Book1.xls]Sheet1!A1"
Dim areas As ReferredAreaCollection = cells("A1").GetPrecedents()
For i As Integer = 0 To areas.Count - 1
    Dim area As ReferredArea = areas(i)
    Dim stringBuilder As StringBuilder = New StringBuilder()
    If (area.IsExternalLink) Then
        stringBuilder.Append("[")
        stringBuilder.Append(area.ExternalFileName)
       stringBuilder.Append("]")
    End If
    stringBuilder.Append(area.SheetName)
    stringBuilder.Append("!")
    stringBuilder.Append(CellsHelper.CellIndexToName(area.StartRow, area.StartColumn))
    If (area.IsArea) Then
        stringBuilder.Append(":")
        stringBuilder.Append(CellsHelper.CellIndexToName(area.EndRow, area.EndColumn))
    End If
    Console.WriteLine(stringBuilder.ToString())
Next

Remarks

  • Returns null if this is not a formula cell.
  • All references appearing in this cell's formula will be returned no matter they are referenced or not while calculating. For example, although cell A2 in formula "=IF(TRUE,A1,A2)" is not used while calculating, it is still taken as the formula's precedents.
  • To get those references which influence the calculation only, please use Aspose.Cells.Cell.GetPrecedentsInCalculation.

GetPrecedentsInCalculation()

Gets all precedents(reference to cells in current workbook) used by this cell’s formula while calculating it.

public IEnumerator GetPrecedentsInCalculation()

Returns

IEnumerator

Enumerator to enumerate all references(ReferredArea)

Examples

[C#]

Workbook workbook = new Workbook();
Cells cells = workbook.Worksheets[0].Cells;
cells["A2"].Formula = "=IF(TRUE,B2,B1)";
workbook.Settings.FormulaSettings.EnableCalculationChain = true;
workbook.CalculateFormula();
IEnumerator en = cells["A2"].GetPrecedentsInCalculation();
Console.WriteLine("A2's calculation precedents:");
while(en.MoveNext())
{
    ReferredArea r = (ReferredArea)en.Current;
    Console.WriteLine(r);
}
```

#### Remarks

This method can only work with the situation that Aspose.Cells.FormulaSettings.EnableCalculationChain
is true for the workbook and the workbook has been fully calculated.
If this cell is not a formula or it does not reference to any other cells, null will be returned.

###  GetRichValue\(\)

Gets rich value of the cell.

```csharp
public CellRichValue GetRichValue()
```

#### Returns

 [CellRichValue](/cells/aspose.cells.cellrichvalue)

###  GetStringValue\(CellValueFormatStrategy\)

Gets the string value by specific formatted strategy.

```csharp
public string GetStringValue(CellValueFormatStrategy formatStrategy)
```

#### Parameters

`formatStrategy` [CellValueFormatStrategy](/cells/aspose.cells.cellvalueformatstrategy)

The formatted strategy.

#### Returns

 [string](https://learn.microsoft.com/dotnet/api/system.string)

###  GetStyle\(\)

Gets the cell style.

```csharp
public Style GetStyle()
```

#### Returns

 [Style](/cells/aspose.cells.style)

Style object.

#### Remarks

To change the style of the cell, please call Cell.SetStyle() method after modifying the returned style object.
This method is same with Aspose.Cells.Cell.GetStyle(System.Boolean) with true value for the parameter.

###  GetStyle\(bool\)

If checkBorders is true, check whether other cells' borders will effect the style of this cell.

```csharp
public Style GetStyle(bool checkBorders)
```

#### Parameters

`checkBorders` [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

Check other cells' borders

#### Returns

 [Style](/cells/aspose.cells.style)

Style object.

###  GetTable\(\)

Gets the table which contains this cell.

```csharp
public ListObject GetTable()
```

#### Returns

 [ListObject](/cells/aspose.cells.tables.listobject)

###  GetValidation\(\)

Gets the validation applied to this cell.

```csharp
public Validation GetValidation()
```

#### Returns

 [Validation](/cells/aspose.cells.validation)

###  GetValidationValue\(\)

Gets the value of validation which applied to this cell.

```csharp
public bool GetValidationValue()
```

#### Returns

 [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

###  GetWidthOfValue\(\)

Gets the width of the value in unit of pixels.

```csharp
public int GetWidthOfValue()
```

#### Returns

 [int](https://learn.microsoft.com/dotnet/api/system.int32)

###  InsertText\(int, string\)

Insert some characters to the cell.
If the cell is rich formatted, this method could keep the original formatting.

```csharp
public void InsertText(int index, string text)
```

#### Parameters

`index` [int](https://learn.microsoft.com/dotnet/api/system.int32)

The index.

`text` [string](https://learn.microsoft.com/dotnet/api/system.string)

Inserted text.

###  IsRichText\(\)

Indicates whether the string value of this cell is a rich formatted text.

```csharp
public bool IsRichText()
```

#### Returns

 [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

###  PutValue\(bool\)

Puts a boolean value into the cell.

```csharp
public void PutValue(bool boolValue)
```

#### Parameters

`boolValue` [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

###  PutValue\(int\)

Puts an integer value into the cell.

```csharp
public void PutValue(int intValue)
```

#### Parameters

`intValue` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Input value

###  PutValue\(double\)

Puts a double value into the cell.

```csharp
public void PutValue(double doubleValue)
```

#### Parameters

`doubleValue` [double](https://learn.microsoft.com/dotnet/api/system.double)

Input value

###  PutValue\(string, bool, bool\)

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.

```csharp
public void PutValue(string stringValue, bool isConverted, bool setStyle)
```

#### Parameters

`stringValue` [string](https://learn.microsoft.com/dotnet/api/system.string)

Input value

`isConverted` [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

True: converted to other data type if appropriate.

`setStyle` [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

True: set the number format to cell's style when converting to other data type

###  PutValue\(string, bool\)

Puts a string value into the cell and converts the value to other data type if appropriate.

```csharp
public void PutValue(string stringValue, bool isConverted)
```

#### Parameters

`stringValue` [string](https://learn.microsoft.com/dotnet/api/system.string)

Input value

`isConverted` [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

True: converted to other data type if appropriate.

###  PutValue\(string\)

Puts a string value into the cell.

```csharp
public void PutValue(string stringValue)
```

#### Parameters

`stringValue` [string](https://learn.microsoft.com/dotnet/api/system.string)

Input value

###  PutValue\(DateTime\)

Puts a DateTime value into the cell.

```csharp
public void PutValue(DateTime dateTime)
```

#### Parameters

`dateTime` [DateTime](https://learn.microsoft.com/dotnet/api/system.datetime)

Input value

#### Examples

This example shows how to set DateTime value to a cell and make it be displayed as date time.
```
csharp
[C#]

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

//Put date time into a cell
Cell cell = cells[0, 0];
cell.PutValue(new DateTime(2023, 5, 15));
Style style = cell.GetStyle(false);
style.Number = 14;
cell.SetStyle(style);
```

#### Remarks

Setting a DateTime value for a cell dose not means the cell will be formatted as date time automatically.
            DateTime value was maintained as numeric value in the data model of both ms excel and Aspose.Cells.
            Whether the numeric value will be taken as the numeric value itself or date time
            depends on the number format applied on this cell. If this cell has not been formatted as date time,
            it will be displayed as a numeric value even though what you input is DateTime.

###  PutValue\(object\)

Puts an object value into the cell.

```csharp
public void PutValue(object objectValue)
```

#### Parameters

`objectValue` [object](https://learn.microsoft.com/dotnet/api/system.object)

input value

###  RemoveArrayFormula\(bool\)

Remove array formula.

```csharp
public void RemoveArrayFormula(bool leaveNormalFormula)
```

#### Parameters

`leaveNormalFormula` [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

True represents converting the array formula to normal formula.

###  Replace\(string, string, ReplaceOptions\)

Replace text of the cell with options.

```csharp
public void Replace(string placeHolder, string newValue, ReplaceOptions options)
```

#### Parameters

`placeHolder` [string](https://learn.microsoft.com/dotnet/api/system.string)

Cell placeholder

`newValue` [string](https://learn.microsoft.com/dotnet/api/system.string)

String value to replace

`options` [ReplaceOptions](/cells/aspose.cells.replaceoptions)

The replace options

###  SetArrayFormula\(string, int, int\)

Sets an array formula(legacy array formula entered via CTRL+SHIFT+ENTER in ms excel) to a range of cells.

```csharp
public void SetArrayFormula(string arrayFormula, int rowNumber, int columnNumber)
```

#### Parameters

`arrayFormula` [string](https://learn.microsoft.com/dotnet/api/system.string)

Array formula.

`rowNumber` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Number of rows to populate result of the array formula.

`columnNumber` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Number of columns to populate result of the array formula.

###  SetArrayFormula\(string, int, int, FormulaParseOptions\)

Sets an array formula to a range of cells.

```csharp
public void SetArrayFormula(string arrayFormula, int rowNumber, int columnNumber, FormulaParseOptions options)
```

#### Parameters

`arrayFormula` [string](https://learn.microsoft.com/dotnet/api/system.string)

Array formula.

`rowNumber` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Number of rows to populate result of the array formula.

`columnNumber` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Number of columns to populate result of the array formula.

`options` [FormulaParseOptions](/cells/aspose.cells.formulaparseoptions)

Options for parsing the formula.

###  SetArrayFormula\(string, int, int, FormulaParseOptions, object\[\]\[\]\)

Sets an array formula to a range of cells.

```csharp
public void SetArrayFormula(string arrayFormula, int rowNumber, int columnNumber, FormulaParseOptions options, object[][] values)
```

#### Parameters

`arrayFormula` [string](https://learn.microsoft.com/dotnet/api/system.string)

Array formula.

`rowNumber` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Number of rows to populate result of the array formula.

`columnNumber` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Number of columns to populate result of the array formula.

`options` [FormulaParseOptions](/cells/aspose.cells.formulaparseoptions)

Options for parsing the formula.

`values` [object](https://learn.microsoft.com/dotnet/api/system.object)\[\]\[\]

values for those cells with given array formula

###  SetCharacters\(FontSetting\[\]\)

Sets rich text format of the cell.

```csharp
public void SetCharacters(FontSetting[] characters)
```

#### Parameters

`characters` [FontSetting](/cells/aspose.cells.fontsetting)\[\]

All Characters objects.

###  SetDynamicArrayFormula\(string, FormulaParseOptions, bool\)

Sets dynamic array formula and make the formula spill into neighboring cells if possible.

```csharp
public CellArea SetDynamicArrayFormula(string arrayFormula, FormulaParseOptions options, bool calculateValue)
```

#### Parameters

`arrayFormula` [string](https://learn.microsoft.com/dotnet/api/system.string)

the formula expression

`options` [FormulaParseOptions](/cells/aspose.cells.formulaparseoptions)

options to parse formula.
            "Parse" option will be ignored and the formula will always be parsed immediately

`calculateValue` [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

whether calculate this dynamic array formula for those cells in the spilled range.

#### Returns

 [CellArea](/cells/aspose.cells.cellarea)

the range that the formula should spill into.

#### Remarks

the returned range may be not same with the actual one that this dynamic array formula spills into.
            If there are non-empty cells in the range, the formula will be set for current cell only and marked as "#SPILL!".
            But for such kind of situation we still return the whole range that this formula should spill into.

###  SetDynamicArrayFormula\(string, FormulaParseOptions, object\[\]\[\], bool, bool\)

Sets dynamic array formula and make the formula spill into neighboring cells if possible.

```csharp
public CellArea SetDynamicArrayFormula(string arrayFormula, FormulaParseOptions options, object[][] values, bool calculateRange, bool calculateValue)
```

#### Parameters

`arrayFormula` [string](https://learn.microsoft.com/dotnet/api/system.string)

the formula expression

`options` [FormulaParseOptions](/cells/aspose.cells.formulaparseoptions)

options to parse formula.
            "Parse" option will be ignored and the formula will always be parsed immediately

`values` [object](https://learn.microsoft.com/dotnet/api/system.object)\[\]\[\]

values(calculated results) for those cells with given dynamic array formula

`calculateRange` [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

Whether calculate the spilled range for this dynamic array formula.
If the "values" parameter is not null and this flag is false,
then the spilled range's height will be values.Length and width will be values[0].Length.

`calculateValue` [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

whether calculate this dynamic array formula for those cells in the spilled range when "values" is null
or corresponding item in "values" for one cell is null.

#### Returns

 [CellArea](/cells/aspose.cells.cellarea)

the range that the formula should spill into.

#### Remarks

the returned range may be not same with the actual one that this dynamic array formula spills into.
            If there are non-empty cells in the range, the formula will be set for current cell only and marked as "#SPILL!".
            But for such kind of situation we still return the whole range that this formula should spill into.

###  SetDynamicArrayFormula\(string, FormulaParseOptions, object\[\]\[\], bool, bool, CalculationOptions\)

Sets dynamic array formula and make the formula spill into neighboring cells if possible.

```csharp
public CellArea SetDynamicArrayFormula(string arrayFormula, FormulaParseOptions options, object[][] values, bool calculateRange, bool calculateValue, CalculationOptions copts)
```

#### Parameters

`arrayFormula` [string](https://learn.microsoft.com/dotnet/api/system.string)

the formula expression

`options` [FormulaParseOptions](/cells/aspose.cells.formulaparseoptions)

options to parse formula.
            "Parse" option will be ignored and the formula will always be parsed immediately

`values` [object](https://learn.microsoft.com/dotnet/api/system.object)\[\]\[\]

values(calculated results) for those cells with given dynamic array formula

`calculateRange` [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

Whether calculate the spilled range for this dynamic array formula.
If the "values" parameter is not null and this flag is false,
then the spilled range's height will be values.Length and width will be values[0].Length.

`calculateValue` [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

whether calculate this dynamic array formula for those cells in the spilled range when "values" is null
or corresponding item in "values" for one cell is null.

`copts` [CalculationOptions](/cells/aspose.cells.calculationoptions)

The options for calculating formula.
            Commonly, for performance consideration, the Aspose.Cells.CalculationOptions.Recursive property should be false.

#### Returns

 [CellArea](/cells/aspose.cells.cellarea)

the range that the formula should spill into.

#### Remarks

the returned range may be not same with the actual one that this dynamic array formula spills into.
            If there are non-empty cells in the range, the formula will be set for current cell only and marked as "#SPILL!".
            But for such kind of situation we still return the whole range that this formula should spill into.

###  SetFormula\(string, object\)

Set the formula and the value(calculated result) of the formula.

```csharp
public void SetFormula(string formula, object value)
```

#### Parameters

`formula` [string](https://learn.microsoft.com/dotnet/api/system.string)

The formula.

`value` [object](https://learn.microsoft.com/dotnet/api/system.object)

The value(calculated result) of the formula.

###  SetFormula\(string, FormulaParseOptions\)

Set the formula and the value(calculated result) of the formula.

```csharp
public void SetFormula(string formula, FormulaParseOptions options)
```

#### Parameters

`formula` [string](https://learn.microsoft.com/dotnet/api/system.string)

The formula.

`options` [FormulaParseOptions](/cells/aspose.cells.formulaparseoptions)

Options for parsing the formula.

###  SetFormula\(string, FormulaParseOptions, object\)

Set the formula and the value(calculated result) of the formula.

```csharp
public void SetFormula(string formula, FormulaParseOptions options, object value)
```

#### Parameters

`formula` [string](https://learn.microsoft.com/dotnet/api/system.string)

The formula.

`options` [FormulaParseOptions](/cells/aspose.cells.formulaparseoptions)

Options for parsing the formula.

`value` [object](https://learn.microsoft.com/dotnet/api/system.object)

The value(calculated result) of the formula.

###  SetSharedFormula\(string, int, int\)

Sets shared formulas to a range of cells.

```csharp
public void SetSharedFormula(string sharedFormula, int rowNumber, int columnNumber)
```

#### Parameters

`sharedFormula` [string](https://learn.microsoft.com/dotnet/api/system.string)

Shared formula.

`rowNumber` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Number of rows to populate the formula.

`columnNumber` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Number of columns to populate the formula.

###  SetSharedFormula\(string, int, int, FormulaParseOptions\)

Sets shared formulas to a range of cells.

```csharp
public void SetSharedFormula(string sharedFormula, int rowNumber, int columnNumber, FormulaParseOptions options)
```

#### Parameters

`sharedFormula` [string](https://learn.microsoft.com/dotnet/api/system.string)

Shared formula.

`rowNumber` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Number of rows to populate the formula.

`columnNumber` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Number of columns to populate the formula.

`options` [FormulaParseOptions](/cells/aspose.cells.formulaparseoptions)

Options for parsing the formula.

###  SetSharedFormula\(string, int, int, FormulaParseOptions, object\[\]\[\]\)

Sets shared formulas to a range of cells.

```csharp
public void SetSharedFormula(string sharedFormula, int rowNumber, int columnNumber, FormulaParseOptions options, object[][] values)
```

#### Parameters

`sharedFormula` [string](https://learn.microsoft.com/dotnet/api/system.string)

Shared formula.

`rowNumber` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Number of rows to populate the formula.

`columnNumber` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Number of columns to populate the formula.

`options` [FormulaParseOptions](/cells/aspose.cells.formulaparseoptions)

Options for parsing the formula.

`values` [object](https://learn.microsoft.com/dotnet/api/system.object)\[\]\[\]

values for those cells with given shared formula

###  SetStyle\(Style\)

Sets the cell style.

```csharp
public void SetStyle(Style style)
```

#### Parameters

`style` [Style](/cells/aspose.cells.style)

The cell style.

#### Remarks

If the border settings are changed, the border of adjust cells will be updated too.

###  SetStyle\(Style, bool\)

Apply the changed property of style to the cell.

```csharp
public void SetStyle(Style style, bool explicitFlag)
```

#### Parameters

`style` [Style](/cells/aspose.cells.style)

The cell style.

`explicitFlag` [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

True, only overwriting formatting which is explicitly set.

###  SetStyle\(Style, StyleFlag\)

Apply the cell style based on flags.

```csharp
public void SetStyle(Style style, StyleFlag flag)
```

#### Parameters

`style` [Style](/cells/aspose.cells.style)

The cell style.

`flag` [StyleFlag](/cells/aspose.cells.styleflag)

The style flag.

###  SetTableFormula\(int, int, string, string, object\[\]\[\]\)

Create two-variable data table for given range starting from this cell.

```csharp
public void SetTableFormula(int rowNumber, int columnNumber, string rowInputCell, string columnInputCell, object[][] values)
```

#### Parameters

`rowNumber` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Number of rows to populate the formula.

`columnNumber` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Number of columns to populate the formula.

`rowInputCell` [string](https://learn.microsoft.com/dotnet/api/system.string)

the row input cell

`columnInputCell` [string](https://learn.microsoft.com/dotnet/api/system.string)

the column input cell

`values` [object](https://learn.microsoft.com/dotnet/api/system.object)\[\]\[\]

values for cells in table formula range

###  SetTableFormula\(int, int, string, bool, object\[\]\[\]\)

Create one-variable data table for given range starting from this cell.

```csharp
public void SetTableFormula(int rowNumber, int columnNumber, string inputCell, bool isRowInput, object[][] values)
```

#### Parameters

`rowNumber` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Number of rows to populate the formula.

`columnNumber` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Number of columns to populate the formula.

`inputCell` [string](https://learn.microsoft.com/dotnet/api/system.string)

the input cell

`isRowInput` [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

Indicates whether the input cell is a row input cell(true) or a column input cell(false).

`values` [object](https://learn.microsoft.com/dotnet/api/system.object)\[\]\[\]

values for cells in table formula range

###  SetTableFormula\(int, int, int, int, int, int, object\[\]\[\]\)

Create two-variable data table for given range starting from this cell.

```csharp
public void SetTableFormula(int rowNumber, int columnNumber, int rowIndexOfRowInputCell, int columnIndexOfRowInputCell, int rowIndexOfColumnInputCell, int columnIndexOfColumnInputCell, object[][] values)
```

#### Parameters

`rowNumber` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Number of rows to populate the formula.

`columnNumber` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Number of columns to populate the formula.

`rowIndexOfRowInputCell` [int](https://learn.microsoft.com/dotnet/api/system.int32)

row index of the row input cell

`columnIndexOfRowInputCell` [int](https://learn.microsoft.com/dotnet/api/system.int32)

column index of the row input cell

`rowIndexOfColumnInputCell` [int](https://learn.microsoft.com/dotnet/api/system.int32)

row index of the column input cell

`columnIndexOfColumnInputCell` [int](https://learn.microsoft.com/dotnet/api/system.int32)

column index of the column input cell

`values` [object](https://learn.microsoft.com/dotnet/api/system.object)\[\]\[\]

values for cells in table formula range

###  SetTableFormula\(int, int, int, int, bool, object\[\]\[\]\)

Create one-variable data table for given range starting from this cell.

```csharp
public void SetTableFormula(int rowNumber, int columnNumber, int rowIndexOfInputCell, int columnIndexOfInputCell, bool isRowInput, object[][] values)
```

#### Parameters

`rowNumber` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Number of rows to populate the formula.

`columnNumber` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Number of columns to populate the formula.

`rowIndexOfInputCell` [int](https://learn.microsoft.com/dotnet/api/system.int32)

row index of the input cell

`columnIndexOfInputCell` [int](https://learn.microsoft.com/dotnet/api/system.int32)

column index of the input cell

`isRowInput` [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

Indicates whether the input cell is a row input cell(true) or a column input cell(false).

`values` [object](https://learn.microsoft.com/dotnet/api/system.object)\[\]\[\]

values for cells in table formula range

###  ToJson\(\)

Convert Aspose.Cells.Cell to JSON struct data.

```csharp
public string ToJson()
```

#### Returns

 [string](https://learn.microsoft.com/dotnet/api/system.string)

###  ToString\(\)

Returns a string represents the current Cell object.

```csharp
public override string ToString()
```

#### Returns

 [string](https://learn.microsoft.com/dotnet/api/system.string)