Ejemplo n.º 1
0
        public void Test_Excel_FileImport()
        {
            using (FileStream fileStream = new FileStream("C:\\Tests\\test.xlsx", FileMode.Open))
            {
                IFileImporter <DataTable> importer = new ExcelDataTableFileImporter();

                var dt = new DataTable();

                importer.Import(dt, fileStream);
            }
        }
Ejemplo n.º 2
0
        public IEnumerable <IModel> Import(int type, Stream stream)
        {
            IFileImporter <DataTable> importer = new ExcelDataTableFileImporter();

            var dt = new DataTable();

            importer.Import(dt, stream);

            if (dt != null)
            {
                var items = ModelBuilder.Build((ModelType)type, dt, _context);
                return(items);
            }
            return(null);
        }