Пример #1
0
        public static IFrameFileWriter CreateWriter(DataFileTypes fileTypes)
        {
            IFrameFileWriter writer = null;

            switch (fileTypes)
            {
                case DataFileTypes._CSV:
                    writer = new Writers.Data.Csv.BasicFrameToCsvWriter();
                    break;
                case DataFileTypes._XLS:
                    throw new NotImplementedException("Writing to Excel 2003 files is not yet supported.");
                    break;
                case DataFileTypes._XLSX:
                    throw new NotImplementedException("Writing to Excel 2007 files is not yet supported.");
                    break;
            }

            return writer;
        }
Пример #2
0
        public static IFrameFileWriter CreateWriter(string fileName, object source)
        {
            IFrameFileWriter writer = null;

            if (source is IFrame)
            {
                string  extension = Path.GetExtension(fileName).ToLower();
                switch (extension)
                {
                    case ".csv":
                        writer = new Writers.Data.Csv.BasicFrameToCsvWriter();
                        break;
                    case ".xls":
                        throw new NotImplementedException("Writing to Excel 2003 files is not yet supported.");
                        break;
                    case ".xlsx":
                        throw new NotImplementedException("Writing to Excel 2007 files is not yet supported.");
                        break;
                }
            }

            return writer;
        }