Example #1
0
 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("该类型方法未实现");
     }
 }
Example #2
0
 /// <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);
     }
 }
Example #3
0
        /// <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);
            }
        }
Example #4
0
 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("该类型方法未实现");
     }
 }
Example #5
0
        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("该类型方法未实现");
            }
        }
Example #6
0
        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("该类型方法未实现");
            }
        }
Example #7
0
 public ExportPdf(MyDocument doc, string[] columnsName)
 {
     MyDoc   = doc;
     Content = ContentFactory.CreateInstance(doc.Content, columnsName);
 }
Example #8
0
 public ExportPdf(MyDocument doc)
     : this(doc, null)
 {
 }
Example #9
0
 public ExportExcel(MyDocument doc)
     : this(doc, null)
 {
 }
Example #10
0
 /// <summary>
 /// 构造函数
 /// </summary>
 public ExportText(MyDocument doc, string[] columnsName)
 {
     MyDoc = doc;
     Content = ContentFactory.CreateInstance(doc.Content, columnsName);
 }
Example #11
0
 public ExportText(MyDocument doc)
     : this(doc, null)
 {
 }
Example #12
0
 public ExportText(MyDocument doc)
     : this(doc, null)
 {
 }
Example #13
0
 public ExportExcel(MyDocument doc)
     : this(doc, null)
 {
 }
Example #14
0
 public ExportPdf(MyDocument doc)
     : this(doc, null)
 {
 }