public frmSendEmail(long IDPhieu, string formClass, long NguoiNhan, DevExpress.XtraGrid.Views.Grid.GridView gridViewMaster, bool UseExport) { if (Init(IDPhieu,formClass,NguoiNhan) == false) return; string line = "______________________________________________________________________________"; if (UseExport) { string path = Path.GetTempFileName(); bool temp = gridViewMaster.OptionsPrint.PrintSelectedRowsOnly; gridViewMaster.OptionsPrint.PrintSelectedRowsOnly = true; gridViewMaster.OptionsPrint.AutoWidth = true; gridViewMaster.ExportToHtml(path); gridViewMaster.OptionsPrint.PrintSelectedRowsOnly = temp; NoiDung.richEditControl.LoadDocument(path, DevExpress.XtraRichEdit.DocumentFormat.Html); try { File.Delete(path); } catch { } NoiDung.richEditControl.Document.InsertText(NoiDung.richEditControl.Document.Range.End, line); } else { int focus = gridViewMaster.FocusedRowHandle; if (focus <= -1) { HelpXtraForm.CloseFormNoConfirm(this); return; } NoiDung.richEditControl.Document.InsertText(NoiDung.richEditControl.Document.Range.Start,line); NoiDung.richEditControl.Document.InsertParagraph(NoiDung.richEditControl.Document.Range.End); foreach (GridColumn col in gridViewMaster.VisibleColumns) { NoiDung.richEditControl.Document.InsertSingleLineText( NoiDung.richEditControl.Document.Range.End, col.Caption + ": " + gridViewMaster.GetRowCellDisplayText(focus, col)); NoiDung.richEditControl.Document.InsertParagraph(NoiDung.richEditControl.Document.Range.End); } NoiDung.richEditControl.Document.InsertText(NoiDung.richEditControl.Document.Range.End,line); } }
private string GetCellHintText(DevExpress.XtraGrid.Views.Grid.GridView view, int rowHandle, DevExpress.XtraGrid.Columns.GridColumn column) { string ret = view.GetRowCellDisplayText(rowHandle, column); foreach(DevExpress.XtraGrid.Columns.GridColumn col in view.Columns) if ( col.VisibleIndex < 0 ) ret += string.Format("\r\n {0}: {1}", col.Caption, view.GetRowCellDisplayText(rowHandle, col)); return ret; }