/// <summary>
/// //通过读入2007Excel表格导入
/// </summary>
/// <param name="myDGV"></param>
public void importFromExcel2007(DataGridView myDGV)
{
DatasetVector DtV;//数据集
Recordset RS = null;
//通过读入Excel表格导入
OpenFileDialog openFileDialog = new OpenFileDialog();
openFileDialog.Filter = "2007Excel文件(*.xls)|*.xls|2007Excel文件(*.xlsx)|*.xlsx|All files (*.*)|*.*";
openFileDialog.FilterIndex = 0;
openFileDialog.RestoreDirectory = true;
openFileDialog.Title = "请选择要导入的Excel文件";
IWorkbook workbook = null;
if (dataGridView1.RowCount>0|| dataGridView1.Columns.Count>1)
{
if (!DelectAll())
{
return;
}
}
if (openFileDialog.ShowDialog() == DialogResult.OK)
{
string fileName = @"" + openFileDialog.FileName + "";
try
{
C#通过Nopi操作EXCEL表
于 2019-04-08 10:11:59 首次发布