C# открытие файла EXCEL

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Microsoft.Office.Interop.Excel;
namespace WindowsFormsApplication4
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {

            Microsoft.Office.Interop.Excel.Application app = new Microsoft.Office.Interop.Excel.Application();
            // Add a new Excel workbook.
            //app.Workbooks.Add();
            app.Visible = true;
     
            app.Workbooks.Open("d:\\Excel\\2015.xlsm", Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
            app.Range["A1"].Value = "ID";
            app.Range["B1"].Value = "Balance - 1000++";
            app.Range["A20"].Select();

        }
    }
}

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *