public static IExport CreateInstance(ExportType type,MyDocument doc) { switch (type) { case ExportType.Xls: return new ExportExcel(doc); case ExportType.Pdf: return new ExportPdf(doc); case ExportType.Txt: return new ExportText(doc); default: throw new ArgumentException("该类型方法未实现"); } }
/// <summary> /// 构造函数 /// 初始化_XlsDoc对象 /// </summary> public ExportExcel(MyDocument doc,string[] needColumns) { MyDoc = doc; XlsDoc = new XlsDocument(); string sheetName = string.Format("{0}", MyDoc.DocName); sheetName = string.IsNullOrEmpty(sheetName) ? "sheet1" : sheetName; CurSheet = XlsDoc.Workbook.Worksheets.Add(sheetName); if (needColumns == null || needColumns.Length == 0) { Content = ContentFactory.CreateInstance(MyDoc.Content); } else { Content = ContentFactory.CreateInstance(MyDoc.Content, needColumns); } }
/// <summary> /// 构造函数 /// 初始化_XlsDoc对象 /// </summary> public ExportExcel(MyDocument doc, string[] needColumns) { MyDoc = doc; XlsDoc = new XlsDocument(); string sheetName = string.Format("{0}", MyDoc.DocName); sheetName = string.IsNullOrEmpty(sheetName) ? "sheet1" : sheetName; CurSheet = XlsDoc.Workbook.Worksheets.Add(sheetName); if (needColumns == null || needColumns.Length == 0) { Content = ContentFactory.CreateInstance(MyDoc.Content); } else { Content = ContentFactory.CreateInstance(MyDoc.Content, needColumns); } }
public static IExport CreateInstance(string path, MyDocument doc,string[] columnsName) { string extName = Path.GetExtension(path); extName = extName.TrimStart(new char[] { '.' }).ToLower(); switch (extName) { case "xls": return new ExportExcel(doc, columnsName); case "pdf": return new ExportPdf(doc, columnsName); case "cvs": case "txt": return new ExportText(doc, columnsName); default: throw new ArgumentException("该类型方法未实现"); } }
public static IExport CreateInstance(ExportType type, MyDocument doc) { switch (type) { case ExportType.Xls: return(new ExportExcel(doc)); case ExportType.Pdf: return(new ExportPdf(doc)); case ExportType.Txt: return(new ExportText(doc)); default: throw new ArgumentException("该类型方法未实现"); } }
public static IExport CreateInstance(string path, MyDocument doc, string[] columnsName) { string extName = Path.GetExtension(path); extName = extName.TrimStart(new char[] { '.' }).ToLower(); switch (extName) { case "xls": return(new ExportExcel(doc, columnsName)); case "pdf": return(new ExportPdf(doc, columnsName)); case "cvs": case "txt": return(new ExportText(doc, columnsName)); default: throw new ArgumentException("该类型方法未实现"); } }
public ExportPdf(MyDocument doc, string[] columnsName) { MyDoc = doc; Content = ContentFactory.CreateInstance(doc.Content, columnsName); }
public ExportPdf(MyDocument doc) : this(doc, null) { }
public ExportExcel(MyDocument doc) : this(doc, null) { }
/// <summary> /// 构造函数 /// </summary> public ExportText(MyDocument doc, string[] columnsName) { MyDoc = doc; Content = ContentFactory.CreateInstance(doc.Content, columnsName); }
public ExportText(MyDocument doc) : this(doc, null) { }