Hello ,
With reference to your query I would like to mention that the behavior you
are experiencing is the default behavior. However, you may use the
following code snippet to do this.
BEGIN CODE
Private Sub button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles button1.Click
' step 1: create a new workbook
Dim book As C1XLBook = New C1XLBook()
' step 2: get the sheet that was created by default, give it a name
Dim sheet As XLSheet = book.Sheets(0)
sheet.Name = "Hello World"
' step 3: create styles for odd and even values
Dim styleOdd As XLStyle = New XLStyle(book)
styleOdd.Font = New Font("Tahoma", 9, FontStyle.Italic)
styleOdd.ForeColor = Color.Blue
Dim styleEven As XLStyle = New XLStyle(book)
styleEven.Font = New Font("Tahoma", 9, FontStyle.Bold)
styleEven.ForeColor = Color.Red
' step 3: write content and format into some cells
Dim i As Integer
For i = 0 To 99
Dim cell As XLCell = sheet(i, 0)
cell.Value = "'0" + CStr(i + 1)
cell.Style = IIf(((i + 1) Mod 2 = 0), styleEven, styleOdd)
Next
' step 4: save the file
Dim fileName As String = Application.StartupPath + "\hello.xls"
book.Save(fileName)
System.Diagnostics.Process.Start(fileName)
End Sub
END CODE
I hope this helps.
Regards,
John Adams
Technical Support, ComponentOne LLC
wrote in message news:199661@10.0.1.98...
I'm using C1 XLS to create Excel files from datasets in an ASP.NET web
application. One problem I'm running into is a format issue with text that
looks like numbers to Excel. For example, US Postal codes that begin with
zero such as 01234 end up in Excel as 1234. Working in Excel, I would solve
that issue by formatting the cell as text or by adding a single quote to the
cell text ('01234).
How can I achieve the same results with C1 XLS? I've looked at
FormatDotNetToXL but the documentation is not helpful. (No examples at all
for one thing).
http://helpcentral.componentone.com/cs/forums/p/73547/199661.aspx#199661