Example #1
0
        private void BtnNpoiExport_Click(object sender, EventArgs e)
        {
            buttonIndex = 1;
            DataTable dataTable = new DataTable();

            dataTable           = gridView.DataSource as DataTable;
            dataTable.TableName = "Sheet";
            //ExprotExcel(gridView);
            SaveFileDialog saveFileDialog = new SaveFileDialog();

            saveFileDialog.Title  = "导出Excel";
            saveFileDialog.Filter = "Excel文件(*.xlsx)|*.xlsx|Excel文件(*.xls)|*.xls";
            DialogResult dialogResult = saveFileDialog.ShowDialog(this);

            if (dialogResult == DialogResult.OK)
            {
                CreatExcel.ExprotToExcel(dataTable, saveFileDialog.FileName, buttonIndex);
                MessageBox.Show("导出成功", "提示", MessageBoxButtons.OK);
            }
        }
Example #2
0
 public static void Create()
 {
     CreatExcel window = GetWindow <CreatExcel>();
 }