BKI_DichVuMatDat.NghiepVu.f370_nhan_vien_loai_lao_dong.m_cmd_tai_file_excel_mau_Click C# (CSharp) Method

m_cmd_tai_file_excel_mau_Click() private method

private m_cmd_tai_file_excel_mau_Click ( object sender, EventArgs e ) : void
sender object
e EventArgs
return void
        void m_cmd_tai_file_excel_mau_Click(object sender, EventArgs e)
        {
            try
            {
                SplashScreenManager.ShowForm(typeof(F_wait_form));
                string fileName = "LOAI_LAO_DONG_CUA_NHAN_VIEN.xlsx";
                string sourcePath = (System.IO.Directory.GetCurrentDirectory() + "\\Template");
                string targetPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
                string sourceFile = System.IO.Path.Combine(sourcePath, fileName);
                string destFile = System.IO.Path.Combine(targetPath, fileName);
                if (!System.IO.Directory.Exists(targetPath))
                {
                    System.IO.Directory.CreateDirectory(targetPath);
                }
                System.IO.File.Copy(sourceFile, destFile, true);
                string newpath = targetPath + "\\LOAI_LAO_DONG_CUA_NHAN_VIEN.xlsx";
                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(newpath);
            }
            catch (Exception v_e)
            {
                CSystemLog_301.ExceptionHandle(v_e);

            }
            finally
            {
                SplashScreenManager.CloseForm();
            }
        }