Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
OWC Formating Columns
The method below write a simple excel sheet to disk from
aspx code. It uses the "Office Web Components" object. The problem is that I am writing "0012" to Cell(A2). If you open the sheet written out, the formating has been applied, but the leading zeros are truncated. For some reason the values are being entered into the sheet before the formatting is being applied. Any ideas? Public Sub Test() Try Dim sFile As String = moWebServer.MapPath(".") & "\Files\MyExcel.xls" Dim XLS As New OWC10.SpreadsheetClass() Dim Sheet As OWC10.Worksheet = XLS.ActiveSheet Sheet.Range(Sheet.Cells(1, 1), Sheet.Cells(1, 1)).EntireColumn.NumberFormat = "#,##0.00" Sheet.Range(Sheet.Cells(1, 2), Sheet.Cells(1, 2)).EntireColumn.NumberFormat = "@" Sheet.Cells(1, 1) = "99.95" Sheet.Cells(1, 2) = "0012" XLS.Export(sFile, ssExportActionNone, ssExportHTML) Catch exp As Exception Dim sErr As String = exp.Message sErr = exp.ToString End Try End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Formating rows and columns | New Users to Excel | |||
HELP FORMATING COLUMNS | Excel Discussion (Misc queries) | |||
PROBLEMS WITH FORMATING COLUMNS | Excel Discussion (Misc queries) | |||
FORMATING COLUMNS..... HELP | New Users to Excel | |||
Formating columns | Excel Discussion (Misc queries) |