Tengo una Web Api donde genero un reporte, lo puedo hacer perfectamente de manera local, porque tomo los archivos .RDLC desde una ruta de mi PC, quisiera poder hacerlo igual en la WebApi, pero tomar los archivos .RDLC desde la ruta del proyecto, o alguna otra ruta que no sea de la pc, porque tengo que consumir los bytes que genera el método, desde una aplicación Android Xamarin, intente cambiar
LocalReport.Path por ServerReport.Path, pero no logro hacerlo funcionar
DataSet ds = bdBase.bdDataset(conexion, sQuery);
if (ds.Tables[0].Rows.Count > 0)
{
reportViewer1.ShowCredentialPrompts = false;
reportViewer1.ProcessingMode = ProcessingMode.Local;
HttpContext.Current.Server.MapPath("~/Reportes/");
switch (llaveemp.ToUpper())
{
case "04146959-9CD5-4419-A35E-88793D1AF8B4":
// FLVales
//HttpContext.Current.Server.MapPath("~/Reportes/promoRecAbonoFLV.rdlc");
reportViewer1.LocalReport.ReportPath="~/Reportes/promoRecAbonoFLV.rdlc";
//reportViewer1.LocalReport.ReportPath = @"C:\Saz\Saz\CrediReports\promoRecAbonoFLV.rdlc";
break;
case "AA8491CA-5E2E-4F3E-B9B2-FB8D3AB69EBD":
// Credimoda
//reportViewer1.LocalReport.ReportPath = @"C:\Saz\Saz\CrediReports\promoRecAbonoFred.rdlc";
/*HttpContext.Current.Server.MapPath*/
reportViewer1.LocalReport.ReportPath= "~/Reportes/promoRecAbonoFred.rdlc";
break;
default:
//reportViewer1.LocalReport.ReportPath = @"C:\Saz\Saz\CrediReports\promoRecAbono.rdlc";
//HttpContext.Current.Server.MapPath("~/Reportes/promoRecAbono.rdlc");
//string path = "~/Reportes/promoRecAbono.rdlc";
reportViewer1.LocalReport.ReportPath = "~/Reportes/promoRecAbono.rdlc";
break;
}
}
reportViewer1.LocalReport.SetParameters(parametros);
reportViewer1.ShowParameterPrompts = false;
reportViewer1.LocalReport.DataSources.Clear();
reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DataSet1", ds.Tables[0]));
Warning[] warnings;
String[] streamids;
String mimeType;
String encoding;
String filenameExtension;
// Render the report to a byte array
Byte[] bytes;
if (reportViewer1.ProcessingMode == ProcessingMode.Local)
bytes = reportViewer1.LocalReport.Render("PDF", null, out mimeType, out encoding, out filenameExtension, out streamids, out warnings);
else
bytes = reportViewer1.ServerReport.Render("PDF", null, out mimeType, out encoding, out filenameExtension, out streamids, out warnings);
var pdfbytes = JsonConvert.SerializeObject(bytes);
return pdfbytes;