C#下对Excel的基本操作

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Office.Interop.Excel;

namespace ConsoleTest1
{
    class Program
    {
        static void Main(string[] args)
        {
            Application excel = new Application();
            excel.Visible = true;
            excel.Workbooks.Add(Type.Missing);
            for (Int32 i = 1; i < 5; i++)
            {
                for (Int32 j = 1; j < 5; j++)
                {
                   excel.Cells[i, j].Value = "(" + i.ToString() + "," + j.ToString() + ")";
                }
            }
        }
    }
}

  

posted @ 2013-10-07 19:21  zkn  阅读(186)  评论(0)    收藏  举报