private void btnBrowse_Nu_Click(object sender, EventArgs e) { OpenFileDialog dlg = new OpenFileDialog(); dlg.Filter = "Rich Text Format (*.rtf)|*.rtf"; if (dlg.ShowDialog(this) == DialogResult.OK) { txtMauBaoCao_Nu.Text = dlg.FileName; foreach (TabPage tabPage in tabMauBaoCao.TabPages) { if (tabPage.Text == "Mẫu báo cáo (Nữ)") { try { TXTextControl.TextControl textControl = (tabPage.Controls[0] as TXTextControl.TextControl); textControl.Load(dlg.FileName, TXTextControl.StreamType.RichTextFormat); textControl.Tables.GridLines = false; break; } catch (Exception ex) { MsgBox.Show(Application.ProductName, ex.Message, IconType.Information); } } } } }
private void btnBrowse_Chung_Click(object sender, EventArgs e) { OpenFileDialog dlg = new OpenFileDialog(); dlg.Filter = "Rich Text Format (*.rtf)|*.rtf"; if (dlg.ShowDialog(this) == DialogResult.OK) { try { txtMauBaoCao_Chung.Text = dlg.FileName; TXTextControl.TextControl textControl = (_page1.Controls[0] as TXTextControl.TextControl); textControl.Load(dlg.FileName, TXTextControl.StreamType.RichTextFormat); textControl.Tables.GridLines = false; } catch (Exception ex) { MsgBox.Show(Application.ProductName, ex.Message, IconType.Information); } } }
private void OnDisplayMauBaoCao() { if (dgLoaiSieuAm.SelectedRows == null || dgLoaiSieuAm.SelectedRows.Count <= 0) { _drLoaiSieuAm = null; //txtTenSieuAm.Text = string.Empty; //txtMauBaoCao_Chung.Text = string.Empty; //txtMauBaoCao_Nam.Text = string.Empty; //txtMauBaoCao_Nu.Text = string.Empty; //_textControl1.ResetContents(); //_textControl2.ResetContents(); return; } _drLoaiSieuAm = (dgLoaiSieuAm.SelectedRows[0].DataBoundItem as DataRowView).Row; if (_flag) { return; } string loaiSieuAmGUID = _drLoaiSieuAm["LoaiSieuAmGUID"].ToString(); Result result = SieuAmBus.GetMauBaoCaoList(loaiSieuAmGUID); if (result.IsOK) { List <MauBaoCao> mauBaoCaoList = (List <MauBaoCao>)result.QueryResult; txtTenSieuAm.Text = _drLoaiSieuAm["TenSieuAm"].ToString(); numThuTu.Value = Convert.ToInt32(_drLoaiSieuAm["ThuTu"]); chkInTrang2.Checked = Convert.ToBoolean(_drLoaiSieuAm["InTrang2"]); chkNam.Checked = false; chkNu.Checked = false; foreach (var mauBaoCao in mauBaoCaoList) { DoiTuong doiTuong = (DoiTuong)mauBaoCao.DoiTuong; TXTextControl.TextControl textControl = null; switch (doiTuong) { case DoiTuong.Chung: raChung.Checked = true; textControl = _textControl1; break; case DoiTuong.Nam: chkNam.Checked = true; raNamNu.Checked = true; foreach (TabPage tabPage in tabMauBaoCao.TabPages) { if (tabPage.Text == "Mẫu báo cáo (Nam)") { textControl = (tabPage.Controls[0] as TXTextControl.TextControl); break; } } break; case DoiTuong.Nu: chkNu.Checked = true; raNamNu.Checked = true; foreach (TabPage tabPage in tabMauBaoCao.TabPages) { if (tabPage.Text == "Mẫu báo cáo (Nữ)") { textControl = (tabPage.Controls[0] as TXTextControl.TextControl); break; } } break; } textControl.Load(mauBaoCao.Template.ToArray(), TXTextControl.BinaryStreamType.MSWord); textControl.Tables.GridLines = false; } } else { MsgBox.Show(Application.ProductName, result.GetErrorAsString("SieuAmBus.GetMauBaoCaoList"), IconType.Error); Utility.WriteToTraceLog(result.GetErrorAsString("SieuAmBus.GetMauBaoCaoList")); } }