// Event private methods private void load_file_excel() { if (m_ofd_exel_file.ShowDialog() == System.Windows.Forms.DialogResult.OK) { try { // Reset lại ds mới nếu chọn lại file excel khác m_ds = new DS_DM_NHAN_SU(); m_lbl_loading_mes.Visible = true; CExcelReport v_excel_rpt = new CExcelReport(m_ofd_exel_file.FileName); m_ds.EnforceConstraints = false; v_excel_rpt.Export2DatasetDS_by_DucVT(m_ds, m_ds.DM_NHAN_SU.TableName, 2); m_fg.Redraw = false; //Gán DataSource //m_fg.DataSource = m_ds.DM_NHAN_SU; CGridUtils.Dataset2C1Grid(m_ds, m_fg, m_obj_trans); m_fg.Redraw = true; m_lbl_loading_mes.Visible = false; } catch (Exception v_e) { CSystemLog_301.ExceptionHandle(v_e); } } }
private void export_2_excel() { CExcelReport v_obj_excel_rpt = new CExcelReport("f404_qua_trinh_cong_tac.xlsx", 3, 1); v_obj_excel_rpt.FindAndReplace(false); v_obj_excel_rpt.Export2ExcelWithoutFixedRows(m_fg, 1, m_fg.Cols.Count - 1, true); }
private void export_2_excel() { CExcelReport v_obj_excel_rpt = new CExcelReport("f403_bao_cao_nhan_su_cap_bac.xlsx", 3, 1); v_obj_excel_rpt.AddFindAndReplaceItem("<thoi_diem>", m_dtp_thoidiem.Value.Date); v_obj_excel_rpt.FindAndReplace(false); v_obj_excel_rpt.Export2ExcelWithoutFixedRows(m_fg, 1, m_fg.Cols.Count - 1, true); }
private void export_2_excel() { CExcelReport v_obj_excel_rpt = new CExcelReport("f407_bao_cao_danh_sach_bo_nhiem.xlsx", 3, 2); v_obj_excel_rpt.AddFindAndReplaceItem("<thoi_diem>", m_dtp_thoidiem.Value.Month); v_obj_excel_rpt.FindAndReplace(false); v_obj_excel_rpt.Export2ExcelWithoutFixedRows(m_fg, 1, m_fg.Cols.Count - 1, true); }
private void export_2_excel() { CExcelReport v_obj_excel_rpt = new CExcelReport("f405_bien_dong_nhan_su_chuc_vu_trang_thai.xlsx", 3, 1); v_obj_excel_rpt.AddFindAndReplaceItem("<thoi_diem>", m_dat_thoidiem.Value.Date); v_obj_excel_rpt.FindAndReplace(false); v_obj_excel_rpt.Export2ExcelWithoutFixedRows(m_fg, 1, m_fg.Cols.Count - 1, true); }
private void export_2_excel() { CExcelReport v_obj_excel_rpt = new CExcelReport("f408_bao_cao_don_vi_trang_thai.xlsx", 3, 2); v_obj_excel_rpt.AddFindAndReplaceItem("<thoi_diem>", m_dat_thoidiem.Value.Date); v_obj_excel_rpt.FindAndReplace(false); v_obj_excel_rpt.Export2ExcelWithoutFixedRows(m_fg_donvi, 1, m_fg_donvi.Cols.Count - 1, true); }
private void export_2_excel() { CExcelReport v_obj_excel_rpt = new CExcelReport("f501_bao_cao_nhan_su_du_an_tu_ngay_den_ngay.xlsx", 6, 1); v_obj_excel_rpt.AddFindAndReplaceItem("<tu_ngay>", m_dat_tu_ngay.Value.Date); v_obj_excel_rpt.AddFindAndReplaceItem("<den_ngay>", m_dat_den_ngay.Value.Date); v_obj_excel_rpt.FindAndReplace(false); v_obj_excel_rpt.Export2ExcelWithoutFixedRows(m_fg, 1, m_fg.Cols.Count - 1, true); }
private void export_2_excel() { CExcelReport v_obj_excel_rpt = new CExcelReport("f409_bao_cao_nghi_viec.xlsx", 3, 2); v_obj_excel_rpt.AddFindAndReplaceItem("<tu_ngay>", m_dtp_tu_ngay.Value); v_obj_excel_rpt.AddFindAndReplaceItem("<den_ngay>", m_dtp_den_ngay.Value); v_obj_excel_rpt.FindAndReplace(false); v_obj_excel_rpt.Export2ExcelWithoutFixedRows(m_fg, 1, m_fg.Cols.Count - 1, true); }
/*private void set_search_format_before() { * if (m_txt_search.Text == "") { * m_txt_search.Text = m_str_goi_y_tim_kiem; * m_txt_search.ForeColor = Color.Gray; * } * }*/ /*private void set_search_format_after() { * if (m_txt_search.Text == m_str_goi_y_tim_kiem) { * m_txt_search.Text = ""; * } * m_txt_search.ForeColor = Color.Black; * }*/ private void xuat_excel() { var v_start_row = 8; var v_start_col = 1; var v_obj_excel_rpt = new CExcelReport("f104_bao_cao_nhan_su_theo_phong_ban.xlsx", v_start_row, v_start_col); v_obj_excel_rpt.AddFindAndReplaceItem("<ngay_thang>", string.Format("{0}/{1}/{2}", DateTime.Now.Day, DateTime.Now.Month, DateTime.Now.Year)); v_obj_excel_rpt.FindAndReplace(false); v_obj_excel_rpt.Export2ExcelWithoutFixedRows(m_fg, 1, m_fg.Cols.Count - 1, true); }
private void xuat_excel() { CExcelReport v_obj_excel = new CExcelReport( "f300_v_gd_hop_dong_lao_dong.xls" , 3 , 3); v_obj_excel.Export2Excel(m_fg , 1 , (int)m_fg.Cols.Count - 1 , true); }
private void xuat_excel() { CExcelReport v_obj_excel = new CExcelReport( "f200_gd_qua_trinh_lam_viec.xls" , 3 , 3); v_obj_excel.Export2Excel(m_fg , 1 , (int)m_fg.Cols.Count - 1 , true); }
private void backgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e) { if (!backgroundWorker1.CancellationPending) { alert.Message = "In progress, please wait... " + e.ProgressPercentage.ToString() + "%"; alert.ProgressValue = e.ProgressPercentage; } var v_start_row = 2; var v_start_col = 1; var v_obj_excel_rpt = new CExcelReport("Employee.xls", v_start_row, v_start_col); //v_obj_excel_rpt.AddFindAndReplaceItem("<ngay_thang>", string.Format("{0}/{1}/{2}", DateTime.Now.Day, DateTime.Now.Month, DateTime.Now.Year)); v_obj_excel_rpt.FindAndReplace(false); v_obj_excel_rpt.Export2ExcelWithoutFixedRows(m_fg, 1, m_fg.Cols.Count - 1, true); }
private void m_cmd_xuat_excel_Click(object sender, EventArgs e) { try { CExcelReport v_obj_excel_report = new CExcelReport( "f100_gd_trang_thai_lao_dong" , 3 , 3 ); v_obj_excel_report.Export2Excel( m_fg , 1 , (int)m_fg.Cols.Count - 1 , true ); } catch (Exception v_e) { CSystemLog_301.ExceptionHandle(v_e); } }
protected void Page_Load(object sender, EventArgs e) { if (Context.Request.Form["listId"] != null) { string listId = Context.Request.Form["listId"]; if (String.IsNullOrEmpty(listId)) { return; } string exportType = "", addressTo = "", fullName = "", telephone = "", email = "", cellPhone = "", position = "", fileName = ""; //"Excel|Pdf string sysViewId = "13"; // "26|27" string languageId = "129"; //"Excel|Pdf if (Context.Request.Form["exportType"] != null) { exportType = Context.Request.Form["exportType"]; } if (Context.Request.Form["sysViewID"] != null) { sysViewId = Context.Request.Form["sysViewId"]; } if (Context.Request.Form["languageId"] != null) { languageId = Context.Request.Form["languageId"]; } if (Context.Request.Form["exportType"] != null) { exportType = Context.Request.Form["exportType"]; } if (Context.Request.Form["sysViewID"] != null) { sysViewId = Context.Request.Form["sysViewId"]; } if (Context.Request.Form["languageId"] != null) { languageId = Context.Request.Form["languageId"]; } if (Context.Request.Form["addressTo"] != null) { addressTo = Context.Request.Form["addressTo"]; } if (Context.Request.Form["fullName"] != null) { fullName = Context.Request.Form["fullName"]; } if (Context.Request.Form["telephone"] != null) { telephone = Context.Request.Form["telephone"]; } if (Context.Request.Form["cellPhone"] != null) { cellPhone = Context.Request.Form["cellPhone"]; } if (Context.Request.Form["position"] != null) { position = Context.Request.Form["position"]; } if (Context.Request.Form["email"] != null) { email = Context.Request.Form["email"]; } ///SUA CHU FILE NAM HOA NHE NAM if (Context.Request.Form["fileName"] != null) { fileName = Context.Request.Form["fileName"]; } if (string.IsNullOrEmpty(fileName)) { fileName = "NONAME"; } // CLogManager.WritePL("email", string.Format("email:{0},cellPhone:{1},telephone:{2},addressTo:{3},fullname:{4},position:{5},exportType:{6},sysViewId:{7}", email, cellPhone, telephone, addressTo,fullName, position, exportType, sysViewId)); try { string contentType = "application/Excel"; //string filename = ".xlsx"; if (exportType.Equals("pdf", StringComparison.OrdinalIgnoreCase)) { contentType = "application/pdf"; if (!fileName.EndsWith(".pdf", StringComparison.OrdinalIgnoreCase)) { fileName += ".pdf"; } } else { if (!fileName.EndsWith(".xlsx", StringComparison.OrdinalIgnoreCase)) { fileName += ".xlsx"; } } string input = string.Format("<RequestParams ListID=\"{0}\" ListProductId=\"{0}\" LanguageID=\"{1}\" ExportType=\"{2}\" start=\"0\" length=\"1\" Sys_ViewID=\"{3}\" ", listId, languageId, exportType, sysViewId); input += string.Format(" FullName=\"{0}\" AddressTo=\"{1}\"", HtmlEncode(fullName), HtmlEncode(addressTo)); input += string.Format(" TelePhone=\"{0}\" CellPhone=\"{1}\" Email=\"{2}\" Position=\"{3}\" FileName=\"{4}\"", HtmlEncode(telephone), HtmlEncode(cellPhone), HtmlEncode(email), HtmlEncode(position), HtmlEncode(fileName)); input += "/>"; if (sysViewId.Equals("26")) { string inputValue = input;// string.Format("<InputValue UserID=\"2\" /><RequestParams ListID=\"{0}\" ListProductId=\"{0}\" LanguageID=\"{1}\" ExportType=\"{2}\" start=\"0\" length=\"1\" Sys_ViewID=\"{3}\" />", listId, languageId, exportType, sysViewId); string template = AppDomain.CurrentDomain.BaseDirectory + "\\_Template\\Excel\\Template_BaoGiaCoBan.xlsx"; string result = new CExcelReport().ExportReport("", inputValue, template); //filename = "BaogiaCoban" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + filename; WriteResponse(contentType, fileName, result); } else if (sysViewId.Equals("27")) { string inputValue = input;// string.Format("<InputValue UserID=\"2\" /><RequestParams ListID=\"{0}\" ListProductId=\"{0}\" LanguageID=\"{1}\" ExportType=\"{2}\" start=\"0\" length=\"1\" Sys_ViewID=\"{3}\" />", listId, languageId, exportType, sysViewId); string template = AppDomain.CurrentDomain.BaseDirectory + "\\_Template\\Excel\\Template_BaoGiaChiTiet.xlsx"; string result = new CExcelReport().ExportReport("", inputValue, template); //filename = "BaogiaChitiet" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + filename; WriteResponse(contentType, fileName, result); } //Export(sData); } catch (Exception ex) { CLogManager.WriteSL("ExportTemplate", ex.ToString()); Console.WriteLine(ex.ToString()); Response.Cookies["iscompleteexport"].Value = "false"; Response.Write(ex.ToString()); Response.End(); // Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "Exception", string.Format("alert('{0}')", ex.ToString()), true); } } }