Exemplo n.º 1
0
        public void ReporteAgricola(int presupuestoId)
        {
            var header = reporte.GetHeader(presupuestoId);
            var data   = reporte.GetAgriculaGroup(presupuestoId);

            ExcelPackage   pck = new ExcelPackage();
            ExcelWorksheet ws  = pck.Workbook.Worksheets.Add("Reporte Agricola");

            ws.Cells["A1"].Value = header.nombre_presupuesto;
            ws.Cells["B1"].Value = "semana " + header.semana + " del " + header.año;

            ws.Cells["A2"].Value = "total: " + header.total;
            ws.Cells["B2"].Value = "Semana uno";

            ws.Cells["A3"].Value = "Fecha de Impresion";
            ws.Cells["B3"].Value = string.Format("{0:dd MMMM yyyy} at {0:H: mm tt}", DateTimeOffset.Now);

            ws.Cells["A6"].Value = "Nombre";
            ws.Cells["B6"].Value = "Total";

            int rowStart = 7;


            ws.Cells["A:AZ"].AutoFitColumns();
            Response.Clear();
            Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
            Response.AddHeader("content-disposition", "attachment: filename=" + "ExcelReport.xlsx");
            Response.BinaryWrite(pck.GetAsByteArray());
            Response.End();
        }