BKI_DichVuMatDat.BaoCao.frm419_bao_cao_thay_doi_cong_tac.m_cmd_export_Click C# (CSharp) Method

m_cmd_export_Click() public method

public m_cmd_export_Click ( object sender, EventArgs e ) : void
sender object
e EventArgs
return void
        void m_cmd_export_Click(object sender, EventArgs e)
        {
            try
            {
                string op_file_name = "Báo cáo thay đổi LNS";
                string dest_file = WinFormControls.saveFileDialog(op_file_name);
                if(dest_file != "")
                {
                    m_grv.ExportToXlsx(dest_file);
                    XtraMessageBox.Show("Đã lưu báo cáo tại " + dest_file + "\nFile sẽ tự động mở ngay sau đây!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    var excel = new Microsoft.Office.Interop.Excel.Application();
                    excel.Visible = true;
                    Microsoft.Office.Interop.Excel.Workbooks books = excel.Workbooks;
                    Microsoft.Office.Interop.Excel.Workbook openexcel = books.Open(dest_file);
                    this.Close();
                }
            }
            catch(Exception v_e)
            {
                CSystemLog_301.ExceptionHandle(v_e);
            }
        }