vineetc 0 Newbie Poster

Hi,

I am unable to convert the excel cell from string format to number format.

The code that I am using is:


<cfset trial_variable = evaluate('getRow' & i & 'TotalBook.totalunit')>
<cfset trial_variable2 = evaluate('getRow' & i & 'Total.totalunit')>
<cfset trial_variable3 = trial_variable/trial_variable2>
<cfset trial_variable4 = trial_variable3*100>
<cfif isNumeric(trial_variable4)>
<Cell ss:StyleID="yellow"><Data ss:Type="Number"><cftry>#Val(round(trial_variable4))#<cfcatch>0</cfca tch></cftry> %</Data></Cell>
<cfelse>
<Cell ss:StyleID="yellow"><Data ss:Type="String"><cftry>#Val(round(trial_variable4))#<cfcatch>0</cfca tch></cftry> %</Data></Cell>
</cfif>

Now, if I use the same code with only one change on the 6th line of code, i.e. instead of data type "Number", I put "String", it works fine..

With "Number", it does not allow me to open the excel sheet. It gives me an error while opening the excel itself.

How can I convert the cell to Number format?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.