We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

How do I get the "formatted" text of a cell value

Thread ID:

Created:

Updated:

Platform:

Replies:

35356 Sep 28,2005 09:56 AM Oct 4,2005 05:15 AM Windows Forms 3
loading
Tags: XlsIO
Holger Haidinger
Asked On September 28, 2005 09:56 AM

Hi, Suppose the following code fragment (V3.3.0.0): ws.Range("A1").Number = 10 ws.Range("A1").NumberFormat = "0 ""ms""" I''am not able to retrieve the string "10 ms". In Excel VBA this can be done using the ''Text'' property of a Range object. Thanks, Holger

Administrator [Syncfusion]
Replied On September 29, 2005 02:28 AM

Hi Holger, Here is the Code Snippet: ws.Range("A1").Number = 10 ws.Rage("A1").NumberFormat = "0 \"ms\"" Please, Let me know if you have further questions. Best Regards, Seetha >Hi, > >Suppose the following code fragment (V3.3.0.0): > >ws.Range("A1").Number = 10 >ws.Range("A1").NumberFormat = "0 ""ms""" > >I''am not able to retrieve the string "10 ms". In Excel VBA this can be done using the ''Text'' property of a Range object. > >Thanks, >Holger

Holger Haidinger
Replied On September 29, 2005 05:00 AM

Hi Seetha, thanks for your quick response. My problem is not the ''NumberFormat'' property but the textual output of the ''Text'' property. My code snippet is VB, I assume that "0 \"ms\"" is C# syntax. I will change my code snippet to be more clearer: ws.Range("A1").Number = 10 ws.Rage("A1").NumberFormat = "0.00" Console.WriteLine(ws.Range("A1").Text) I expected that ws.Range("A1").Text would result in "10.00" but it returned "10" (like ws.Range("A1").Value). Excel VBA returns "10.00" instead (the decimal separator is country specific). Do you know a way to retrieve the string "10.00"? Best regards, Holger >Hi Holger, > >Here is the Code Snippet: > >ws.Range("A1").Number = 10 >ws.Rage("A1").NumberFormat = "0 \"ms\"" > >Please, Let me know if you have further questions. > >Best Regards, >Seetha > > >>Hi, >> >>Suppose the following code fragment (V3.3.0.0): >> >>ws.Range("A1").Number = 10 >>ws.Range("A1").NumberFormat = "0 ""ms""" >> >>I''am not able to retrieve the string "10 ms". In Excel VBA this can be done using the ''Text'' property of a Range object. >> >>Thanks, >>Holger

Administrator [Syncfusion]
Replied On October 4, 2005 05:15 AM

Hi Holger, Sorry for delay in getting back to you. I have already logged a feature request regarding this issue, you can track the status of this issue here. http://www.syncfusion.com/support/features/xlsio/Default.aspx?ToDo=view&questId=366 Best Regards, Seetha >Hi Seetha, > >thanks for your quick response. > >My problem is not the ''NumberFormat'' property but the textual output of the ''Text'' property. > >My code snippet is VB, I assume that "0 \"ms\"" is C# syntax. > >I will change my code snippet to be more clearer: > >ws.Range("A1").Number = 10 >ws.Rage("A1").NumberFormat = "0.00" >Console.WriteLine(ws.Range("A1").Text) > >I expected that ws.Range("A1").Text would result in "10.00" but it returned "10" (like ws.Range("A1").Value). Excel VBA returns "10.00" instead (the decimal separator is country specific). > >Do you know a way to retrieve the string "10.00"? > >Best regards, >Holger > >>Hi Holger, >> >>Here is the Code Snippet: >> >>ws.Range("A1").Number = 10 >>ws.Rage("A1").NumberFormat = "0 \"ms\"" >> >>Please, Let me know if you have further questions. >> >>Best Regards, >>Seetha >> >> >>>Hi, >>> >>>Suppose the following code fragment (V3.3.0.0): >>> >>>ws.Range("A1").Number = 10 >>>ws.Range("A1").NumberFormat = "0 ""ms""" >>> >>>I''am not able to retrieve the string "10 ms". In Excel VBA this can be done using the ''Text'' property of a Range object. >>> >>>Thanks, >>>Holger

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;