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.
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");
System.Object
C1.Excel.XLCell