コード例 #1
0
 /// <summary>
 /// 将DataGridView数据导出到Excel
 /// </summary>
 /// <param name="dataGridView">导出的DataGridView对象</param>
 /// <param name="fileName">文件名</param>
 public static void DataGridViewToExcel(DataGridView dataGridView, string fileName)
 {
     try
     {
         ExcelControl exportToExcel = new ExcelControl();
         exportToExcel.OutputAsExcelFile(dataGridView, fileName);
     }
     catch (Exception)
     {
         throw;
     }
 }
コード例 #2
0
        public static void ExcelToDataGridView(DataGridView DGV)
        {
            ExcelControl input = new ExcelControl();

            DGV.DataSource = input.InputToDataGridView();
        }