首先 下载 org.in2bits.MyXls.dll
https://download.csdn.net/download/qq_30725967/87858610
项目中添加引用:
using org.in2bits.MyXls;
实例代码:
using System;
using System.Data;
using System.Windows.Forms;
using org.in2bits.MyXls;
namespace ExportExcel
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
DataTable dt = new DataTable();
DataColumn col1 = new DataColumn("col1");
DataColumn col2 = new DataColumn("col2");
DataColumn col3 = new DataColumn("col3");
DataColumn col4 = new DataColumn(