Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Formating rows and columns Dave New Users to Excel 1 May 22nd 08 10:52 PM
HELP FORMATING COLUMNS Ron Coderre Excel Discussion (Misc queries) 0 July 4th 07 12:10 AM
PROBLEMS WITH FORMATING COLUMNS JTEFUN Excel Discussion (Misc queries) 3 July 3rd 07 09:56 PM
FORMATING COLUMNS..... HELP JTEFUN New Users to Excel 4 July 3rd 07 07:31 PM
Formating columns dbrumit Excel Discussion (Misc queries) 4 January 11th 05 01:21 PM


All times are GMT +1. The time now is 10:28 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"