Microsoft.Office.Interop.Excel API 应用(一)ExcelApplication

本文档介绍了如何在项目中引用并使用Microsoft.Office.Interop.Excel API进行Excel操作,包括添加引用、导入命名空间以及基本的代码示例。

1. 项目中添加引用“Microsoft.Office.Interop.Excel” ;

2. 添加using “”using Microsoft.Office.Interop.Excel;

 

Code:

using System.Threading;
using System.Runtime.InteropServices;
using System.Diagnostics;
using System;
using Microsoft.Office.Interop.Excel;

namespace OfficeUtility
{
    /// <summary>
    /// Start an excel process with some parameters setting
    /// </summary>
    public class ExcelApp : IDisposable
    {
        [DllImport("user32.dll")]
        static extern int GetWindowThreadProcessId(int hWnd, out int lpdwProcessId);

        private Application excelAppInstance = null;

        public Application ExcelAppInstance
        {
            get
            {
                return excelAppInstance;
            }
        }

        /// <summary>
        /// Create an new excel app instance
        /// </summary>
        /// <param name="visible">true if
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值