[]
        
(Showing Draft Content)

C1.Excel.XLCell

XLCell Class

Represents individual cells in an XLSheet and provides properties for getting and setting the cell Value, Style, and Hyperlink.

Inheritance
XLCell
Implements
Namespace: C1.Excel
Assembly: C1.Excel.dll
Syntax
public class XLCell : ICloneable
Remarks
<p>To create cells, use the <xref href="C1.Excel.XLSheet" data-throw-if-not-resolved="false"></xref> indexer (Item property). 

If the cell already exists, the reference will be returned as usual. If not, the sheet will create the cell (as well as rows and columns if necessary) and will return a reference to the new cell.

Because it creates cells automatically, the indexer is especially useful when creating and populating sheets.

Examples

For example, the code below creates a new C1XLBook, then populates the first sheet with a 10 by 10 multiplication table:

C1XLBook book = new C1XLBook();
XLSheet sheet = book.Sheets[0];
for (int r = 0; r < 10; r++)
{
  for (int c = 0; c < 10; c++)
  {
    XLCell cell = sheet[r, c];
	cell.Value = (r+1) * (c+1);
  }
}
book.Save(@"c:\temp\test.xls");

Note how the code simply accesses the cells using the indexer. There's no need to create any rows, columns, or cells. The indexer takes care of all that automatically.

Constructors

Name Description
XLCell()

Properties

Name Description
Formula

Gets or sets a string that specifies a formula of the cell.

Gets or sets a string that specifies an action to take when the cell is clicked.

Style

Gets or sets the XLStyle object associated with the cell.

Text

Gets the simple text representation of the current cell value.

Value

Gets or sets the value stored in the cell.

Methods

Name Description
Clone()

Creates a copy of the current cell, including the value.

SetValue(object, XLStyle)

Sets the Value and Style properties of a cell.