コード例 #1
0
        public FileResult Download()
        {
            IExcelsior excelsior = new Excelsior();

            List <Person> persons = GetPersons();

            byte[] bytes = excelsior.Excelify(persons, true);
            return(File(bytes, "application/vnd.ms-excel", "persons.xlsx"));
        }
コード例 #2
0
        public ActionResult Upload()
        {
            if (Request.Files.Count > 0)
            {
                var file = Request.Files[0];

                if (file != null && file.ContentLength > 0)
                {
                    IExcelsior excelsior = new Excelsior();
                    var        asdf      = excelsior.Arrayify(file, true);
                }
            }

            return(RedirectToAction("Index"));
        }
コード例 #3
0
        public void should_parse_nullable_properties_of_dto()
        {
            //-----------------------------------------------------------------------------------------------------------
            // Arrange
            //-----------------------------------------------------------------------------------------------------------
            string uriPath  = Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase) + "\\spreadsheets\\GeneticTypeWorkbook.xlsx";
            string filePath = new Uri(uriPath).LocalPath;

            var excelsior = new Excelsior();

            //-----------------------------------------------------------------------------------------------------------
            // Act
            //-----------------------------------------------------------------------------------------------------------
            List <StockImportExcelDto> result = excelsior.Listify <StockImportExcelDto>(filePath, true).ToList();

            //-----------------------------------------------------------------------------------------------------------
            // Assert
            //-----------------------------------------------------------------------------------------------------------
            Assert.AreEqual(result.Count, 4);
            Assert.IsTrue(result.Any(x => x.Quantity.HasValue));
        }