To format the cells of a book, complete the following steps:
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Dim style1 As New XLStyle(C1XLBook1) style1.ForeColor = Color.Gold style1.BackColor = Color.Blue style1.Format = "$ .00" |
To write code in C#
C# |
Copy Code
|
---|---|
XLStyle style1 = new XLStyle(c1XLBook1); style1.ForeColor = Color.Gold; style1.BackColor = Color.Blue; style1.Format = "$ .00"; |
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Dim sheet As XLSheet = C1XLBook1.Sheets(0) Dim i As Integer For i = 0 To 9 sheet(i,0).Value = i + 1 sheet(i, 0).Style = style1 Next i |
To write code in C#
C# |
Copy Code
|
---|---|
C1.C1Excel.XLSheet sheet = c1XLBook1.Sheets[0]; int i; for (i = 0; i <= 9; i++) { sheet[i,0].Value = i + 1; sheet[i, 0].Style = style1; } |
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
C1XLBook1.Save("c:\mybook.xls") System.Diagnostics.Process.Start("C:\mybook.xls") |
To write code in C#
C# |
Copy Code
|
---|---|
c1XLBook1.Save(@"c:\mybook.xls"); System.Diagnostics.Process.Start(@"C:\mybook.xls"); |