110,538
社区成员
发帖
与我相关
我的任务
分享
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Microsoft.Office.Interop;
namespace OFFICEtEST
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Microsoft.Office.Interop.Excel.Application app1 = new Microsoft.Office.Interop.Excel.Application();
app1.Visible = true;
Workbook book1 = app1.Workbooks.Add(Type.Missing);
Worksheet sheet1 = (Worksheet)book1.Sheets[1];
Range rng1 = sheet1.get_Range("A1", Type.Missing);
rng1.Value2 = "Heee";
}
}
}
Microsoft.Office.Interop.Excel.Application app1 = new Microsoft.Office.Interop.Excel.Application();
app1.Visible = true;
Microsoft.Office.Interop.Excel.Workbook book1 = app1.Workbooks.Add(Type.Missing);
Microsoft.Office.Interop.Excel.Worksheet sheet1 = (Microsoft.Office.Interop.Excel.Worksheet)book1.Sheets[1];
Microsoft.Office.Interop.Excel.Range rng1 = sheet1.get_Range("A1", Type.Missing);
rng1.Value2 = "Hello World!";