Beispiel #1
0
        static void SaveExcel()
        {
            FileInfo fi = null;
            fi = new FileInfo(@"D:\CurrentDevelopment\Cresa\test.xlsx");
            var stream = new MemoryStream(File.ReadAllBytes(fi.FullName));
            Cresa.Services.Excel.ExcelReader reader = new Services.Excel.ExcelReader();

            var template = reader.ReadExcel(stream);
            var srv = new Cresa.Services.Excel.ListingExcelService("");
            var excelBytes = srv.Export(template, "48013");
            File.WriteAllBytes(@"D:\CurrentDevelopment\Cresa\out.xlsx", excelBytes);
        }
Beispiel #2
0
        static void CreateExcel()
        {
            string type = "";
            OracleRepository rep = new OracleRepository();
            MemoryStream stream =(MemoryStream) rep.LoadListingDocument("701", out type);
            Cresa.Services.Excel.ExcelReader reader = new Services.Excel.ExcelReader();

            var template = reader.ReadExcel(stream);
            var srv = new Cresa.Services.Excel.ListingExcelService("");
            var excelBytes = srv.Export(template, "48013");
            File.WriteAllBytes(@"D:\CurrentDevelopment\Cresa\out.xlsx", excelBytes);
        }
Beispiel #3
0
        static void LoadExcel()
        {
            FileInfo fi = null;
            fi = new FileInfo(@"D:\CurrentDevelopment\Cresa\out.xlsx");
            var stream = new MemoryStream(File.ReadAllBytes(fi.FullName));
            Cresa.Services.Excel.ExcelReader reader = new Services.Excel.ExcelReader();

            var data = reader.ReadExcel(stream);
               // var sheets = data.Where(x => x.SheetName == "Sale").ToList();

            foreach (var sheet in data)
            {
                var srv = new Cresa.Services.Excel.ListingExcelService(sheet.SheetName.Trim());
                srv.Import(sheet, "test");
                Console.WriteLine(data);
            }
        }
        public ActionResult ExportListing(string id)
        {
            string type = "";
            OracleRepository rep = new OracleRepository();
            MemoryStream stream = (MemoryStream)rep.LoadListingDocument("701", out type);
            Cresa.Services.Excel.ExcelReader reader = new Services.Excel.ExcelReader();

            var template = reader.ReadExcel(stream);
            var srv = new Cresa.Services.Excel.ListingExcelService("");
            var excelBytes = srv.Export(template, id);
            Response.AddHeader("Content-Disposition","attachment; filename=Cresa - Industrial Market Availabilities.xlsx");
            return new FileContentResult(excelBytes,
                "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
        }