public ExportEventArgs(ExportType type, IExportElement document, bool sendByEmail, string fileName) { Settings = new ExportSettings(); SetTitle(fileName); ExportType = type; SendByEmail = sendByEmail; ExportDocument(document); }
public ExportFactory(Document doc, IExportElement exportHandle) { if (exportHandle == null || doc == null) { throw new NullReferenceException("exportHandle or doc parameter is null reference !!"); } m_ExportLevel = 5; m_Document = doc; m_ExportHandle = exportHandle; }
private void ExportDocument(IExportElement document) { ExportVisitor visitor; if (ExportType == ExportType.Html || ExportType == ExportType.Pdf) { visitor = new HtmlExportVisitor(); } else { visitor = new CsvExportVisitor(); } document.ExportTo(visitor); Document = visitor.GetResult(); }
public void ExportElement(IExportElement element, DataSet ds) { Type type = element.GetType(); DataTable dt = ds.Tables[type.Name]; if (dt == null) { throw new Exception("数据集中找不到对应表:" + type.Name); } DataRow dr = dt.NewRow(); PropertyInfo[] props = type.GetProperties(); if (props == null || props.Length == 0) { return; } foreach (PropertyInfo pro in props) { if (IsExport(pro)) { FillDataColumn(pro, dr, element); } } dt.Rows.Add(dr); }
public void Add(IExportElement element) { _Elements.Add(element); }
private void FillDataColumn(PropertyInfo p, DataRow dr, IExportElement element) { dr[p.Name] = p.GetValue(element, null); }
private void SetProperty(string propName, object value, IExportElement element) { try { PropertyInfo pro = element.GetType().GetProperty(propName); if (pro != null) { pro.SetValue(element, value, null); } } catch (Exception ex) { throw ex; } }
private void FillCustom(CustomElement custom, IExportElement data) { PropertyInfo[] props = data.GetType().GetProperties(); foreach (PropertyInfo prop in props) { PropertyInfo prop1 = custom.GetType().GetProperty(prop.Name); if (prop1 != null) { prop.SetValue(data, prop1.GetValue(custom), null); } } }