C1.Excel Assembly / C1.Excel Namespace / XLCell Class
Members Example

XLCell Class
Represents individual cells in an XLSheet and provides properties for getting and setting the cell Value, Style, and Hyperlink.
Object Model
XLCell Class
Syntax
'Declaration
 
Public Class XLCell 
 
Remarks

To create cells, use the XLSheet 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.

Example
For example, the code below creates a new C1XLBook, then populates the first sheet with a 10 by 10 multiplication table: 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.
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");
Inheritance Hierarchy

System.Object
   C1.Excel.XLCell

See Also