Solved

How Chartting with Microsoft Excel and ASP.net

Posted on 2010-08-15
10
344 Views
Last Modified: 2012-05-10
Hi,
I would like to use excel 2007 for present a diagram by providing its data via asp.net c#. Would you plese help me?
0
Comment
Question by:Pouyan-Sepahvand
10 Comments
 
LVL 19

Expert Comment

by:Amandeep Singh Bhullar
ID: 33443498
0
 

Author Comment

by:Pouyan-Sepahvand
ID: 33443571
Hi AmanBhullar,
I visited the site but when i imported the code to .net web app i faced error. How can run this sample or import it to .net web app?
0
 
LVL 14

Expert Comment

by:Dhanasekaran Sengodan
ID: 33443627
0
 
LVL 4

Expert Comment

by:Audhi203
ID: 33443647
0
 

Author Comment

by:Pouyan-Sepahvand
ID: 33444130
Dear All,
I faced the following error:
System.Runtime.InteropServices.COMException (0x80028018): Old format or invalid type library
When i used one of the solution. I searched to solve the error but i couldn't find a useful one.

All the best
Pouyan
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:Pouyan-Sepahvand
ID: 33444133
I used visual studio 2005 and office 2007
0
 
LVL 14

Expert Comment

by:Dhanasekaran Sengodan
ID: 33444508
0
 
LVL 14

Expert Comment

by:Dhanasekaran Sengodan
ID: 33444521
new reference from the Project->Add References... menu choice. Go to the COM tab and choose the most current Microsoft Excel library. Then go to the References folder under the solutions explorer and remove the Excel and Microsoft.Office.Core references. If you get some compile errors like Excel is not a valid reference or something like that, put this into the using directives:
using Excel = Microsoft.Office.Interop.Excel;
I am wondering if the the Excel and Microsoft.Office.Core references are causing some conflicts.

I hope this helps.
0
 
LVL 14

Accepted Solution

by:
Dhanasekaran Sengodan earned 500 total points
ID: 33444527
0
 

Author Comment

by:Pouyan-Sepahvand
ID: 33452109
Dear All,

Thank you very much. Finally i could charting with ASP.NET and Excel by the following step:

1- I used this link: http://www.codeproject.com/KB/aspnet/ExcelShtAndChrt-In-aspx.aspx
2-I faced the following exception:

System.Runtime.InteropServices.COMException (0x80028018): Old format or invalid type library. (Exception from HRESULT: 0x80028018 (TYPE_E_INVDATAREAD)) at Microsoft.Office.Interop.Excel.Workbooks.Open(String Filename, Object UpdateLinks, Object ReadOnly, Object Format, Object Password, Object WriteResPassword, Object IgnoreReadOnlyRecommended, Object Origin, Object Delimiter, Object Editable, Object Notify, Object Converter, Object AddToMru, Object Local, Object CorruptLoad) at ExcelSheetDisplay.GetListofSheetsAndCharts(String strFileName, Boolean bReadOnly, DropDownList drpList) in C:\TEMP\WebApplication1\WebApplication1\ExcelSheetDisplay.aspx.cs:line 128

3-After searching i recognized it is a microsoft bug for those who have set up multiple language in her regional setting. For resolving the problem before using Workbooks object should use the following code:
        System.Globalization.CultureInfo oldCI = System.Threading.Thread.CurrentThread.CurrentCulture;
        System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");

the link which helped me is:
http://www.gotdotnet.ru/forums/2/52390/256671/#post256671

All the best
Pouyan
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
ASP.net Run 3 sliders vertically as opposed to horizontally 9 18
SQL Exceptions 3 36
FormulaArray VBA Issue 6 17
Excel copy picture into Outlook email 7 44
Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now