Example #1
0
 private static void GeneraArchivoEnBytes(ArchivoReporte Archivo, PlantillaExcel Plantilla)
 {
     using (var ArchivoEnMemoria = new MemoryStream())
     {
         var ArchivoExcel = GenerarExcelNPOI(Plantilla);
         ArchivoExcel.Write(ArchivoEnMemoria);
         Archivo.ArchivoByte = ArchivoEnMemoria.ToArray();
     }
 }
Example #2
0
        public static ArchivoReporte ExportarArchivo(PlantillaExcel Plantilla)
        {
            var resultado = new ArchivoReporte();

            GenerarNombreArchivoYContentType(resultado, Plantilla);
            GeneraArchivoEnBytes(resultado, Plantilla);

            return(resultado);
        }
Example #3
0
 private static void GenerarNombreArchivoYContentType(ArchivoReporte resultado, PlantillaExcel Plantilla)
 {
     resultado.ContentType   = "application/vnd.ms-excel";
     resultado.NombreArchivo = string.Format("{0}.xlsx", Plantilla.NombreArchivo ?? "ReportExcel");
 }