示例#1
0
        public void CreateSpreadSheetTest()
        {
            ExcelService service    = new ExcelService();
            bool         isActual   = service.CreateSpreadSheet();
            bool         isExpected = true;

            Assert.AreEqual(isExpected, isActual);
        }
示例#2
0
        public ActionResult GetExcelFile()
        {
            MemoryStream excelStream = new MemoryStream();
            var          excelFile   = new ExcelService();
            bool         fileCreated = excelFile.CreateSpreadSheet();

            excelStream = excelFile.SpreadsheetStream;

            HttpContext.Response.Clear();
            HttpContext.Response.AddHeader("content-disposition", "attachment;filename=test.xls");
            excelStream.WriteTo(HttpContext.Response.OutputStream);
            excelStream.Close();
            HttpContext.Response.End();

            return(View());
        }