Represents individual cells in an XLSheet and provides
properties for getting and setting the cell Value,
Style, and Hyperlink.
Namespace:
C1.Silverlight.ExcelAssembly: C1.Silverlight.Excel.5 (in C1.Silverlight.Excel.5.dll)
Syntax
C# |
---|
public class XLCell : ICloneable |
Visual Basic |
---|
Public Class XLCell _ Implements ICloneable |
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.
Examples
For example, the code below creates a new C1XLBook, then
populates the first sheet with a 10 by 10 multiplication table:
Copy CodeC#
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.Silverlight.Excel..::..XLCell
C1.Silverlight.Excel..::..XLCell