Click here to Skip to main content
15,888,733 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I try to download data from DataGridView Control to Excel 2007,but exsiting coding error,you can see below the code :(i use VS2008 + Windows XP + Excel 2007),
and i think the code is used in Excel 2003 but i don't install Office 2003.
CODE:
//建立Excel对象
C#
using Excel = Microsoft.Office.Interop.Excel;
Excel.Application excel = new Excel.Application();
excel.Application.Workbooks.Add(true);
excel.Visible = isShowExcle;

How to modify it?
thanks!


*Updated to put in code block.
Posted
Updated 9-Apr-12 4:43am
v2

1 solution

You will probably need to update the reference to the version of Excel.Interop that you have installed on your machine.

To do this:

1. In the Solution Explorer window, open the References item to display it's contents.
2. Right-click on the Microsoft.Office.Interop.Excel and click Remove.
3. Right-click on the References item and select Add Reference.
4. Select the .NET tab.
5. Scroll until you find the Component Name of Microsoft.Office.Interop.Excel.
6. Select it and click OK.
7. Recompile and run.
 
Share this answer
 
v2
Comments
faterge 9-Apr-12 22:56pm    
how to do? Get a Path or method ! Thanks Caydence!
Tim Groven 10-Apr-12 8:57am    
Updated the answer, let me know if that works.

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