public ActionResult ExportReport(ReportViewerHelper.ReportType reportType = ReportViewerHelper.ReportType.PDF, string orderProperty = null, bool orderAscending = true) { byte[] bytes = GetCadastroService().ExportReportCategoria(reportType, orderProperty, orderAscending); if (bytes != null) { string filename = "RelatorioCategoria"; switch (reportType) { case ReportViewerHelper.ReportType.Excel: filename += ".xls"; break; case ReportViewerHelper.ReportType.PDF: filename += ".pdf"; break; case ReportViewerHelper.ReportType.Word: default: filename += ".doc"; break; } return(File(bytes, "application/octet-stream", filename)); } else { return(ErrorMessage("Erro", "Não foi possível gerar o relatório!")); } }
public byte[] ExportReportCategoria(ReportViewerHelper.ReportType reportType, string orderProperty, bool orderAscending) { var items = ListarCategorias(0, int.MaxValue, orderProperty, orderAscending); return(ReportViewerHelper.ExportReport(reportType, @"Reports\Categoria.rdlc", items)); }