C1Excel Task-Based Help > Formatting Cells |
To format the cells of a book, complete the following steps:
C# |
Copy Code
|
---|---|
// Create a new workbook to be saved C1XLBook book = new C1XLBook(); |
C# |
Copy Code
|
---|---|
// Create a new style XLStyle style1 = new XLStyle(book); style1.ForeColor = Colors.Yellow; style1.BackColor = Colors.Blue; style1.Format = "$ .00"; // Add content and apply styles to cells in first column of sheet XLSheet sheet = book.Sheets[0]; int i; for (i = 0; i <= 9; i++) { sheet[i, 0].Value = i + 1; sheet[i, 0].Style = style1; } |
C# |
Copy Code
|
---|---|
// Save and open the file book.Save(@"C:\test.xls"); System.Diagnostics.Process.Start(@"C:\test.xls"); |