C# automation Excel

来源:互联网 发布:oracle 分组排序SQL 编辑:程序博客网 时间:2024/05/17 21:50
C# automation Excel
添加using:
using System.Reflection;using Excel = Microsoft.Office.Interop.Excel;


加入引用:

C:\Program Files\Microsoft Visual Studio 10.0\Visual Studio Tools for Office\PIA\Office12\Microsoft.Office.Interop.Excel.dll

测试代码:
namespace Tmp{    class Program    {        static void Main(string[] args)        {            Excel.Application app = null;            app = new Excel.Application();            if ( null != app )            {                app.Visible = true;                //TODO: do something                app.Quit();            }        }    }}