Click here to Skip to main content
15,895,557 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,
Here is a problem when i am passing values to the excel spread sheet from the c# application through the SQL, the values which i am passing are not showing as it is in the excel spread sheet i.e, numbers for example 65234451254 is the number, but it's showing in the excel sheet(in a cell) as 6.52E+10. Without making any modifications in the excel sheet how can i get the same value(65234451254).

If we send alphanumeric value to the excel sheet it is showing as it is the value which is passed from the application. But i don't want to pass the vales like that, i just want numeric values as it is.

Please tell me the solution.
Thank you...
in advance..
Posted
Updated 23-May-12 8:53am
v2

1 solution

When you open the Excel Sheet, you should be able to expand the excel column to show the whole number. I you want more control on Excel (Column width), you will need to use the Excel Interopt, or a third party control such as ExcelWriter. I know that if you are using ASP.NET, or doing this on a server, you cannot open an excel spreadsheet in Excel.
 
Share this answer
 
Comments
anilkumar.6714 23-May-12 21:23pm    
After expanding the excel column also it's showing like that only(6.52E+10),if my value is more than 11 digits i am getting this problem,without making any modifications in excel sheet please tell me the solution from c# application
Clifford Nelson 24-May-12 0:03am    
Maybe what you will need to do is use the Excel Interopt to create the Excel spreadsheet instead of using SQL.
pietvredeveld 25-May-12 16:33pm    
The SQL approach is not the problem. It is the way Excel displays numeric values.
Don't know how hard the 'without making any modifications in excel sheet' requirement is. When only values may be added, then the best guess is to find a Excel option to change the default display numeric values behaviour.
When no calculations are involved you can parse the values as alphanumeric values.

With the interop assemblies you are able to add some formatting to the numeric cells. But that is modifying the excel sheet. Probably no one will notice it, but still...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900