Question around setting a cell value

Hi, I have a decimal number stored in a string. I want to assign this value to a cell, but I do not want to convert it from string to decimal before setting the cells'' IRange.Value2 property. For example: string mynumber = "20.18"; IRange myRange = sheet.Range[1,1]; myRange.Value2 = mynumber myRange.NumberFormat = "0.00"; Will this display the number as 20.18, and will Excel recognise this value as a Decimal instead of a string? Thanks, Luke.

1 Reply

AD Administrator Syncfusion Team October 13, 2005 12:35 PM UTC

Hi Luke, This code will display the number as 20.18 and when the number format is given as "0.00" , excel will recognize this value as decimal. Best Regards, Seetha >Hi, > >I have a decimal number stored in a string. I want to assign this value to a cell, but I do not want to convert it from string to decimal before setting the cells'' IRange.Value2 property. > >For example: >string mynumber = "20.18"; >IRange myRange = sheet.Range[1,1]; >myRange.Value2 = mynumber >myRange.NumberFormat = "0.00"; > >Will this display the number as 20.18, and will Excel recognise this value as a Decimal instead of a string? > >Thanks, >Luke.

Loader.
Up arrow icon