public AutoPrintCls(ServerReport serverReport) : this((Report)serverReport) { RenderAllServerReportPages(serverReport); }
protected void ImgBtnExcel_Click(object sender, ImageClickEventArgs e) { try { ServerReport serverReport = ReportViewer1.ServerReport; ReportViewer1.ProcessingMode = ProcessingMode.Remote; serverReport.ReportServerUrl = new Uri("http://gbsql01/reportserver"); serverReport.ReportPath = "/Intranet/Stores List"; ReportParameter[] filters = new ReportParameter[2]; filters[0] = new ReportParameter("Region", ddRegion.SelectedValue); filters[1] = new ReportParameter("Division", ddDivision.SelectedValue); ReportViewer1.ServerReport.SetParameters(filters); //ReportViewer1.ServerReport.Refresh(); byte[] data = ReportViewer1.ServerReport.Render("excel"); Response.Clear(); Response.ContentType = "application/excel"; Response.AddHeader("Content-Disposition", string.Format("attachment;filename=\"{0}\"", "Store_Locations.xls")); Response.BinaryWrite(data); } catch { lblMessage.ForeColor = Color.Red; lblMessage.Text = "We are experiencing some issues with our server, please try again later"; } }
/// <summary> /// Renders a server report. /// </summary> /// <param name="serverReport">The server report to render.</param> private void RenderReport(ServerReport serverReport) { if (serverReport == null) { return; } _pages.Clear(); // Generating Image renderer pages a la carte can be expensive. To generate page 2, the server needs to recalculate and discard page 1. // Using PersistStreams causes the server to generate all pages in the background while returning after page 1 is complete. NameValueCollection firstPageParameters = new NameValueCollection(); firstPageParameters.Add("rs:PersistStreams", "True"); // GetNextStream returns the next page in the sequence from the background process started by PersistStreams. NameValueCollection nonFirstPageParameters = new NameValueCollection(); nonFirstPageParameters.Add("rs:GetNextStream", "True"); // render and store streams string mimeType, fileExtension; Stream pageStream = serverReport.Render("IMAGE", _deviceInfo, firstPageParameters, out mimeType, out fileExtension); // The server returns an empty stream when moving beyond the last page. while (pageStream.Length > 0) { _pages.Add(pageStream); pageStream = serverReport.Render("IMAGE", _deviceInfo, nonFirstPageParameters, out mimeType, out fileExtension); } }
private void Sales_Reports_No_INTR(string username) { ServerReport serverReport = ReportViewer1.ServerReport; ReportViewer1.ProcessingMode = ProcessingMode.Remote; serverReport.ReportServerUrl = new Uri(serverReportUri); serverReport.ReportPath = "/PompsReports/New/YTD_Sales_NO_INTR"; ServerReport serverReport2 = ReportViewer2.ServerReport; ReportViewer2.ProcessingMode = ProcessingMode.Remote; serverReport2.ReportServerUrl = new Uri(serverReportUri); serverReport2.ReportPath = "/PompsReports/New/YTD_Sales_NO_INTR_b"; try { ReportParameter[] filters = new ReportParameter[2]; filters[0] = new ReportParameter("UserLogin", username); filters[1] = new ReportParameter("Cust_Cls", "All"); ReportViewer1.ServerReport.SetParameters(filters); ReportViewer1.ServerReport.Refresh(); ReportViewer2.ServerReport.SetParameters(filters); ReportViewer2.ServerReport.Refresh(); } catch (Exception ex) { throw ex; } }
/// <summary> /// Renders a local report to a Microsoft Word document on disk. /// </summary> /// <param name="report">The report</param> /// <param name="fileFormat"> /// The export format (report.ListRenderingExtensions()), should be: /// "WORD" for DOC /// "WORDOPENXML" for DOCX /// "EXCEL" for XLS /// "EXCELOPENXML" for XLSX /// </param> public static byte[] ExportToFile(this ServerReport report, ReportingServiceOutputFileFormat fileFormat) { return(ExportToFile(report, new ReportSettings() { OutputType = fileFormat })); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { String vIdInforme = Request.QueryString["id"]; if (Convert.ToBoolean(Session["AUTH"])) { ServerReport serverReport = ReportViewer1.ServerReport; serverReport.ReportServerCredentials = new ReportServerCredentials(@"report_user", "kEbn2HUzd$Fs2T", "adbancat.hn"); serverReport.ReportServerUrl = new Uri("http://10.128.0.52/ReportServer"); serverReport.ReportPath = "/Auditoria Interna/AuditoriaInforme"; ReportParameter vReportParameter = new ReportParameter(); vReportParameter.Name = "INFORME"; vReportParameter.Values.Add(vIdInforme); ReportViewer1.ServerReport.SetParameters(new ReportParameter[] { vReportParameter }); } else { Response.Redirect("/login.aspx"); } } }
private void StartUpRenderReports(string userAccess, string reportName) { ServerReport serverReport3 = ReportViewer4.ServerReport; ReportViewer4.ProcessingMode = ProcessingMode.Remote; ReportViewer4.ShowToolBar = false; ReportViewer4.ShowParameterPrompts = false; ReportViewer4.SizeToReportContent = true; ReportViewer4.Width = Unit.Percentage(100); ReportViewer4.Width = Unit.Percentage(100); serverReport3.ReportServerUrl = new Uri("http://gbsql01/reportserver"); if (reportName == "KPI") { lblTitle.Text = "Key Performance Indicators"; if (cbExcludeIntracompany.Checked == true) { serverReport3.ReportPath = "/PompsReports/New/KPI_NO_INTR_" + userAccess; } else { serverReport3.ReportPath = "/PompsReports/New/KPI_" + userAccess; } } else { lblTitle.Text = "Road Service"; serverReport3.ReportPath = "/PompsReports/New/" + reportName + userAccess; cbExcludeIntracompany.Visible = false; lblIntracompany.Visible = false; } ReportViewer4.ServerReport.Refresh(); }
private void SsrsViewer_Load(object sender, EventArgs e) { try { this.ssrsMainViewer.ProcessingMode = ProcessingMode.Remote; ServerReport serverReport = this.ssrsMainViewer.ServerReport; System.Net.NetworkCredential credentials = new System.Net.NetworkCredential("Administrator", "Nuti123@#", "SERVER3"); ////////WINDOWS AUTHENTICATION!!! System.Net.ICredentials credentials = System.Net.CredentialCache.DefaultCredentials;// Get a reference to the default credentials ReportServerCredentials rsCredentials = serverReport.ReportServerCredentials; // Get a reference to the report server credentials rsCredentials.NetworkCredentials = credentials; // Set the credentials for the server report serverReport.ReportServerUrl = new Uri(this.printViewModel.ReportServerUrl); //// Set the report server URL and report path serverReport.ReportPath = "/" + this.printViewModel.ReportFolder + "/" + this.printViewModel.ReportPath; if (this.printViewModel.ReportParameters != null && this.printViewModel.ReportParameters.Count > 0) { this.ssrsMainViewer.ServerReport.SetParameters(this.printViewModel.ReportParameters); // Set the report parameters for the report } this.ssrsMainViewer.ShowPromptAreaButton = this.printViewModel.ShowPromptAreaButton; this.ssrsMainViewer.RefreshReport(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
protected void Page_Load(object sender, EventArgs e) { string rsname = "powerbi/Kiosk?rs:embed=true"; // Request.QueryString["rsname"]; string environment = "reportsPBI"; //ConfigurationManager.AppSettings["RsPath"]; if (!Page.IsPostBack) { //账户信息如果以后需要维护再放到Web.config中; ReportViewer1.ServerReport.ReportServerCredentials = new ReportServerCredentials("spark.zhou", "Password1", ""); ReportViewer1.SizeToReportContent = true; ReportViewer1.Width = Unit.Percentage(100); ReportViewer1.Height = Unit.Percentage(100); ReportViewer1.BackColor = System.Drawing.Color.AliceBlue; ReportViewer1.KeepSessionAlive = true; // Set the processing mode for the ReportViewer to Remote ReportViewer1.ProcessingMode = ProcessingMode.Remote; ServerReport serverReport = ReportViewer1.ServerReport; // Set the report server URL and report path serverReport.ReportServerUrl = new Uri("http://192.168.26.56/"); serverReport.ReportPath = string.Format("/{0}/{1}", environment, rsname); } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { try { // Set the processing mode for the ReportViewer to Remote ReportViewer1.ProcessingMode = ProcessingMode.Remote; ServerReport serverReport = ReportViewer1.ServerReport; // Set the report server URL and report path //serverReport.ReportServerUrl = // new Uri("http://dw01wsr001/reportserver"); //serverReport.ReportPath = // "/Reportes/SaldoEnMora"; // Create the sales order number report parameter //ReportParameter salesOrderNumber = new ReportParameter(); //salesOrderNumber.Name = "SalesOrderNumber"; //salesOrderNumber.Values.Add("SO43661"); // //// Set the report parameters for the report //reportViewer.ServerReport.SetParameters( // new ReportParameter[] { salesOrderNumber }); } catch (Exception ex) { lbWarning1.Text = ex.Message + " 12345 " + ex.InnerException; } } }
//[Authorize] public ActionResult Index() { ServerReport report = new ServerReport(); //astea tb sa le facem cumva global dada var reportViewer = new ReportViewer(); reportViewer.ProcessingMode = ProcessingMode.Remote; reportViewer.ServerReport.ReportServerCredentials = new CustomCredentials(); reportViewer.ServerReport.ReportPath = "/Test/PieChart"; reportViewer.ServerReport.ReportServerUrl = new Uri(AppConstants.ServerURL); reportViewer.SizeToReportContent = true; reportViewer.Width = Unit.Percentage(100); reportViewer.Height = Unit.Percentage(100); ViewBag.reportView = reportViewer; AccuracyViewModel accuracy = new AccuracyViewModel { ClientNames = db.Accuracy_Setup.ToList().Select(a => a.CUSTOMER).ToList() }; return(View(accuracy)); }
protected void btnQuery_Click(object sender, EventArgs e) { //string strContractNo = txtContract.Text.Trim(); DataTable dtJoList = GetOASJoList(txtContract.Text.Trim().ToString()); if (!(dtJoList.Rows.Count > 0)) { lblMessage.Visible = true; reportViewer.Visible = false; return; } reportViewer.Visible = true; // Set the processing mode for the ReportViewer to Remote reportViewer.ProcessingMode = ProcessingMode.Remote; ServerReport serverReport = reportViewer.ServerReport; // Set the report server URL and report path serverReport.ReportServerUrl = new Uri("http://192.168.7.112/ReportServer"); serverReport.ReportPath = "/OAS.Report/PrintContract"; reportViewer.ServerReport.ReportServerCredentials = new CustomReportCredentials("gfg1_029", "Sa2011", "GFG1"); List <ReportParameter> parameters = new List <ReportParameter>(); //parameters.Add(new ReportParameter("ContractNo", "OAS-GEG-1311-0006")); parameters.Add(new ReportParameter("ContractNo", dtJoList.Rows[0][0].ToString())); reportViewer.ServerReport.SetParameters(parameters); this.reportViewer.ShowParameterPrompts = false; this.reportViewer.ServerReport.Refresh(); }
private void CompareServerReport(ServerReport expected, ServerReport current) { Assert.AreEqual(expected.ReportPath, current.ReportPath); Assert.AreEqual(expected.ReportServerUrl, current.ReportServerUrl); TestParameters(expected.GetParameters().ToList(), current.GetParameters().ToList()); }
/// <summary> /// Open the SSRS report based on the name of the report and Report Parameters specified. /// </summary> /// <param name="reportViewer">ReportViewer /// object used to render the SSRS report on screen.</param> /// <param name="reportPath">Name of the Report /// (.rdl) data uploaded on the server.</param> /// <param name="reportParameterList"> /// List of Report parameters.</param> public static void DisplayReport(ReportViewer reportViewer, String reportPath, List <ReportParameter> reportParameterList) { try { reportViewer.ProcessingMode = ProcessingMode.Remote; ServerReport serverreport = reportViewer.ServerReport; ICredentials credentials = CredentialCache.DefaultCredentials; ReportServerCredentials rscredentials = serverreport.ReportServerCredentials; rscredentials.NetworkCredentials = credentials; serverreport.ReportServerUrl = new Uri(GetReportServerURL()); serverreport.ReportPath = reportPath; reportViewer.ShowParameterPrompts = false; reportViewer.ShowPrintButton = true; if (reportParameterList != null) { foreach (ReportParameter param in reportParameterList) { serverreport.SetParameters(param); } } reportViewer.Refresh(); reportViewer.SetDisplayMode(DisplayMode.PrintLayout); } catch (Exception) { throw; } }
protected void Page_Load(object sender, EventArgs e) { string rsname = Request.QueryString["rsname"]; //"Registration"; // string environment = ConfigurationManager.AppSettings["RsPath"]; if (!Page.IsPostBack) { //账户信息如果以后需要维护再放到Web.config中; ReportViewer1.ServerReport.ReportServerCredentials = new ReportServerCredentials("administrator", "a6GAly@$zX&?%TB8fCPZ7O2Zx5kF)=-.", ""); ReportViewer1.SizeToReportContent = true; ReportViewer1.Width = Unit.Percentage(100); ReportViewer1.Height = Unit.Percentage(100); ReportViewer1.BackColor = ColorTranslator.FromHtml("#f3f3f3"); //System.Drawing.Color.AliceBlue; ReportViewer1.KeepSessionAlive = false; // Set the processing mode for the ReportViewer to Remote ReportViewer1.ProcessingMode = ProcessingMode.Remote; ServerReport serverReport = ReportViewer1.ServerReport; // Set the report server URL and report path http://127.0.0.1/reportserver serverReport.ReportServerUrl = new Uri("http://127.0.0.1/reportserver"); serverReport.ReportPath = string.Format("/{0}/{1}", environment, rsname); } }
private void SsrsViewer_Load(object sender, EventArgs e) { try { this.ssrsMainViewer.ProcessingMode = ProcessingMode.Remote; ServerReport serverReport = this.ssrsMainViewer.ServerReport; //System.Net.NetworkCredential credentials = new System.Net.NetworkCredential("CommonOnly", "123", "DELL-E7240T\\SQL2016"); //SQL LOGON //DELL-E7240T\SQL2016 System.Net.ICredentials credentials = System.Net.CredentialCache.DefaultCredentials; // Get a reference to the default credentials ReportServerCredentials rsCredentials = serverReport.ReportServerCredentials; // Get a reference to the report server credentials rsCredentials.NetworkCredentials = credentials; // Set the credentials for the server report serverReport.ReportServerUrl = new Uri(this.printViewModel.ReportServerUrl); //// Set the report server URL and report path serverReport.ReportPath = "/" + this.printViewModel.ReportFolder + "/" + this.printViewModel.ReportPath; if (this.printViewModel.ReportParameters != null && this.printViewModel.ReportParameters.Count > 0) { this.ssrsMainViewer.ServerReport.SetParameters(this.printViewModel.ReportParameters); // Set the report parameters for the report } this.ssrsMainViewer.ShowPromptAreaButton = this.printViewModel.ShowPromptAreaButton; this.ssrsMainViewer.RefreshReport(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public ViewResult LaunchReport() { try { ReportViewer reportViewer = new ReportViewer(); ServerReport serverReport = reportViewer.ServerReport; reportViewer.ProcessingMode = ProcessingMode.Remote; // Set the report server URL and report path serverReport.ReportServerUrl = new Uri("http://reporting-dev.ultimatemedical.edu/"); serverReport.ReportPath = "/Reports/Pages/Report.aspx?ItemPath=%2fCall+Compliance%2fODS+Status"; //reportViewer.ServerReport.ReportPath = "/AdventureWorks 2012/Sales_by_Region"; //reportViewer.ServerReport.ReportServerUrl = new Uri ("http://localhost/ReportServer/"); //reportViewer.ServerReport.ReportPath = // "http://mlk-ssr-d-sq01/Reports/Pages/Report.aspx?ItemPath=%2fCall+Compliance%2fODS+Status"; //reportViewer.ServerReport.ReportServerUrl = new Uri("http://reporting-dev.ultimatemedical.edu/"); ViewBag.ReportViewer = reportViewer; } catch (Exception ex) { } return(View()); //var result = new { Status = true, Title = "title", Message = "all good" }; //return Json (result, JsonRequestBehavior.AllowGet); //return RedirectToAction ("LaunchReport", "Reporting"); }
//[Authorize] public ActionResult Index() { ServerReport report = new ServerReport(); //astea tb sa le facem cumva global dada var reportViewer = new ReportViewer(); reportViewer.ProcessingMode = ProcessingMode.Remote; reportViewer.ServerReport.ReportServerCredentials = new CustomCredentials(); reportViewer.ServerReport.ReportPath = "/Test/PieChart"; reportViewer.ServerReport.ReportServerUrl = new Uri(AppConstants.ServerURL); reportViewer.SizeToReportContent = true; reportViewer.Width = Unit.Percentage(100); reportViewer.Height = Unit.Percentage(100); ViewBag.reportView = reportViewer; AccuracyViewModel accuracy = new AccuracyViewModel { ClientNames = db.Accuracy_Setup.ToList().Select(a=>a.CUSTOMER).ToList() }; return View(accuracy); }
private void RenderAllServerReportPages(ServerReport serverReport) { string deviceInfo = CreateEMFDeviceInfo(); // Generating Image renderer pages one at a time can be expensive. In order // to generate page 2, the server would need to recalculate page 1 and throw it // away. Using PersistStreams causes the server to generate all the pages in // the background but return as soon as page 1 is complete. NameValueCollection firstPageParameters = new NameValueCollection(); firstPageParameters.Add("rs:PersistStreams", "True"); // GetNextStream returns the next page in the sequence from the background process // started by PersistStreams. NameValueCollection nonFirstPageParameters = new NameValueCollection(); nonFirstPageParameters.Add("rs:GetNextStream", "True"); string mimeType; string fileExtension; Stream pageStream = serverReport.Render("IMAGE", deviceInfo, firstPageParameters, out mimeType, out fileExtension); // The server returns an empty stream when moving beyond the last page. while (pageStream.Length > 0) { m_pages.Add(pageStream); pageStream = serverReport.Render("IMAGE", deviceInfo, nonFirstPageParameters, out mimeType, out fileExtension); } }
public async Task <bool> ConsumeReport(ServerReport report) { if (report != null && !string.IsNullOrEmpty(report.ServerName)) { report.LastUpdated = DateTime.Now; if (!currentServerReports.ContainsKey(report.ServerName)) { // Add currentServerReports.Add(report.ServerName, report); } else { // Update currentServerReports[report.ServerName] = report; } CleanupStaleServers(); await _hubContext.Clients.All.SendAsync("OnReceivedReport", currentServerReports); return(true); } return(false); }
/// <summary> /// Prints a server report wihthout ReportViewer when the "Print Server Report" button is pressed /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ButtonPrintServer_Click(object sender, EventArgs e) { // Create a ServerReport object directly ServerReport report = new ServerReport(); // Get report path from configuration file report.ReportServerUrl = new Uri(ConfigurationManager.AppSettings["ReportServerUrl"], UriKind.Absolute); report.ReportPath = String.Format("{0}/{1}{2}", ConfigurationManager.AppSettings["SampleReportsPath"], // folder or site path "Product Catalog 2008", // report name (ConfigurationManager.AppSettings["ReportServerMode"] == "SharePoint" ? ".rdl" : String.Empty)); // extension, depending on the report server mode // (for information on the report path format, // see http://msdn.microsoft.com/en-us/library/ms252075.aspx) ReportPrintDocument printdoc = null; try { // Print the report using the ReportPrintDocument class (see ReportPrintDocument.cs) printdoc = new ReportPrintDocument(report); printdoc.Print(); } finally { if (printdoc != null) { printdoc.Dispose(); } } }
public void SetProperties_WithServerReport() { ServerReport serverReport = new ServerReport(); serverReport.SetProperties(testData.ReportViewerTests.ServerReport); CompareServerReport(testData.ReportViewerTests.ServerReport, serverReport); }
public static byte[] ExportToFile(this ServerReport report, ReportSettings settings) { var deviceInfo = PrepareAndGetDeviceInfo(report, settings); report.SetParameters(new ReportParameter(PersianRenderer.GreewfIgnorePersianCorrectionParameterName, settings.IgnorePersianCorrection.ToString())); return(report.Render(GetOutputFileFormat(settings.OutputType), deviceInfo)); }
public void ExportarRelatorio1(string NomeRelatorio, enTipoRelatorio TipoRel) { ServerReport sReport = new ServerReport(); sReport.ReportServerUrl = new Uri(ConfigurationManager.AppSettings["Relatorios"]); sReport.ReportPath = NomeRelatorio; Byte[] mybytes1 = sReport.Render(TipoRel.ToString()); }
public byte[] ReportGenerateCustom(out string mimeType, string ReportFormatType = "PDF", string UserName = null, List <ReportParameter> RParams = null, string ReportName = null) { mimeType = ""; byte[] Bytes; PrintedBy = UserName; FileType = ReportFormatType; string encoding; string fileNameExtension; string deviceinfo = "<DeviceInfo>" + " <OutputFormat>" + ReportFormatType + "</OutputFormat>" + "</DeviceInfo>"; Warning[] warnings; string[] streams; ReportViewer reportViewer1 = new ReportViewer(); reportViewer1.ProcessingMode = ProcessingMode.Local; ServerReport serverReport = reportViewer1.ServerReport; // Set the report server URL and report path //serverReport.ReportServerUrl = // new Uri(ConfigurationManager.AppSettings["RSDomain"]); serverReport.ReportServerUrl = new Uri(ConfigurationManager.AppSettings["RSServer"]); serverReport.ReportPath = ConfigurationManager.AppSettings["RSPath"] + ReportName; IReportServerCredentials irsc = new CustomReportCredentials(ConfigurationManager.AppSettings["RSID"], ConfigurationManager.AppSettings["RSPWD"], ConfigurationManager.AppSettings["RSDomain"]); serverReport.ReportServerCredentials = irsc; serverReport.SetParameters(RParams); Bytes = serverReport.Render( ReportFormatType, deviceinfo, out mimeType, out encoding, out fileNameExtension, out streams, out warnings); //return reportViewer1; return(Bytes); }
/// <summary> /// Método de extensión para deshabilitar las extensiones de exportación de los reportes /// </summary> /// <param name="serverReport">El objeto ServerReport.</param> /// <param name="formatsToDisable">Listado de extensiones a deshabilitar.</param> /// <remarks> /// Autor: William Vásquez R. - INTRGRUPO\wvasquez /// FechaDeCreacion: 28/02/2013 /// UltimaModificacionPor: William Vásquez R. - INTRGRUPO\wvasquez /// FechaDeUltimaModificacion: 28/02/2013 /// EncargadoSoporte: William Vásquez R. - INTRGRUPO\wvasquez /// Descripción: /// </remarks> public static void DisableUnwantedExportFormats(this ServerReport serverReport, params string[] formatsToDisable) { foreach (RenderingExtension extension in serverReport.ListRenderingExtensions()) { if (formatsToDisable.Contains(extension.Name)) { ReflectivelySetVisibilityFalse(extension); } } }
public ReportPrintDocument(ServerReport serverReport) : this((Microsoft.Reporting.WinForms.Report)serverReport) { RenderAllServerReportPages(serverReport); PrinterSettings.MinimumPage = 1; PrinterSettings.FromPage = 1; PrinterSettings.ToPage = m_pages.Count; PrinterSettings.MaximumPage = m_pages.Count; }
public void DisableUnwantedExportFormats(ServerReport rvServer) { foreach (RenderingExtension extension in rvServer.ListRenderingExtensions()) { //if (extension.Name == "XML" || extension.Name == "TIFF" || extension.Name == "MHTML" || extension.Name == "EXCEL" || extension.Name == "CSV") if (extension.Name == "XML" || extension.Name == "IMAGE" || extension.Name == "MHTML" || extension.Name == "CSV") { ReflectivelySetVisibilityFalse(extension); } } }
private void Report_Load(object sender, EventArgs e) { try { ReportViewer reportViewer1 = new ReportViewer(); this.Controls.Add(reportViewer1); reportViewer1.Dock = DockStyle.Fill; reportViewer1.ProcessingMode = ProcessingMode.Remote; ServerReport serverReport = reportViewer1.ServerReport; // Get a reference to the default credentials System.Net.ICredentials credentials = System.Net.CredentialCache.DefaultCredentials; // Get a reference to the report server credentials ReportServerCredentials rsCredentials = serverReport.ReportServerCredentials; // Set the credentials for the server report rsCredentials.NetworkCredentials = credentials; // Set the report server URL and report path serverReport.ReportServerUrl = new Uri("http://192.168.1.27/reportserver/"); serverReport.ReportPath = "/HcRockstar/HC_TrainingUsage"; //// Create the sales order number report parameter ReportParameter reportParam1 = new ReportParameter(); reportParam1.Name = "pCounter"; reportParam1.Values.Add(trainingUsage); ReportParameter reportParam2 = new ReportParameter(); reportParam2.Name = "pWordsEn"; reportParam2.Values.Add(null); ReportParameter reportParam3 = new ReportParameter(); reportParam3.Name = "pWordsId"; reportParam3.Values.Add(null); reportViewer1.ShowParameterPrompts = false; // Set the report parameters for the report reportViewer1.ServerReport.SetParameters( new ReportParameter[] { reportParam1, reportParam2, reportParam3 }); reportViewer1.Name = "Training End Usage"; reportViewer1.RefreshReport(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
protected override void OnLoad(EventArgs e) { if (!this.Page.IsPostBack && Session[Strings.ReportParameterList] != null) { try { ReportData table = Session[Strings.ReportParameterList].Cast <ReportData>(); this.Title = table.ReportName; string serverUrl = Config.Get <string>(Strings.ReportServerUrl); ServerReport server = this.ReportViewer1.ServerReport; server.ReportServerUrl = new Uri(serverUrl); server.ReportPath = table.ReportPath; //A value of -1 means that there is no time-out period. server.Timeout = -1; bool anonimous = Config.Get <bool>(Strings.ReportServerAnonimousLoging); if (!anonimous) { string userName = Config.Get <string>(Strings.ReportServerUserName); string userPass = Config.Get <string>(Strings.ReportServerUserPass); string domain = Config.Get <string>(Strings.ReportServerDomainName); server.ReportServerCredentials = new ReportServerCredentials(userName, userPass, domain); } this.ReportViewer1.ProcessingMode = ProcessingMode.Remote; this.ReportViewer1.ServerReport.SetParameters(table.List); this.ReportViewer1.ServerReport.Refresh(); StringBuilder b = new StringBuilder(); foreach (ReportParameter p in table.List) { b.Append(p.toString()); b.AppendLine(); } diag.Trace.WriteLine(b.ToString()); } catch (Exception ex) { diag.Trace.WriteLine(ex); #if DEBUG txtMessage.Text = ex.ToString(); #else txtMessage.Text = ERRMSG; #endif } finally { Session.Remove(Strings.ReportParameterList); } } base.OnLoad(e); }
public ReportSeviceCaller() { var rv = new ReportViewer { ProcessingMode = ProcessingMode.Remote, AsyncRendering = false, }; _serverReport = rv.ServerReport; _serverReport.ReportServerUrl = new Uri(ReportServerUrl); _serverReport.ReportPath = RelativeReportPath; }
/// <summary> /// Configura el objeto ReportViewer para visualizar un reporte desde el servidor de reportes, obteniendo el nombre del reporte de la propiedad NombreReporte /// </summary> /// <remarks> /// Autor: William Vsquez R. - INTRGRUPO\wvasquez /// FechaDeCreacion: 28/02/2013 /// UltimaModificacionPor: William Vsquez R. - INTRGRUPO\wvasquez /// FechaDeUltimaModificacion: 28/02/2013 /// EncargadoSoporte: William Vsquez R. - INTRGRUPO\wvasquez /// Descripcin: /// </remarks> private void ConfigurarVisorRemoto() { string urlReportes = ConfigurationManager.AppSettings["ReportesServidor"].ToString(); string urlCarpeta = ConfigurationManager.AppSettings["ReportesCarpeta"].ToString(); ServerReport serverReport = rpvGenericoMultiple.ServerReport; serverReport.ReportServerUrl = new Uri(urlReportes); serverReport.ReportPath = urlCarpeta + this.NombreReporte; rpvGenericoMultiple.ProcessingMode = ProcessingMode.Remote; serverReport.Timeout = 0; this.DeshabilitarExtensiones(serverReport); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ReportViewer1.ProcessingMode = ProcessingMode.Remote; ServerReport serverReport = ReportViewer1.ServerReport; serverReport.ReportServerUrl = new Uri("http://gcfd-intranet/reportserver"); serverReport.ReportPath = "/CCKReports/AllRecipeReport"; ReportViewer1.ServerReport.Refresh(); } }
private void GenerateReport(string reportName) { string mimeType; string encoding; string fileNameExtension; string deviceInfo = string.Empty; //The DeviceInfo settings should be changed based on the reportType //http://msdn2.microsoft.com/en-us/library/ms155397.aspx deviceInfo = "<DeviceInfo>" + " <OutputFormat>Excel</OutputFormat>" + " <PageWidth>11in</PageWidth>" + "</DeviceInfo>"; Warning[] warnings; string[] streams; byte[] renderedBytes; //Render the report ServerReport serverReport = new ServerReport(); Uri serverUrl = new Uri(@"http://puketi/ReportServer_SQL2012EXPRESS"); serverReport.ReportServerUrl = serverUrl; serverReport.ReportPath = string.Format("/ICMS/{0}", reportName); renderedBytes = serverReport.Render( "Excel", deviceInfo, out mimeType, out encoding, out fileNameExtension, out streams, out warnings); Response.Clear(); Response.ContentType = mimeType; Response.AddHeader("content-disposition", "attachment; filename=TempReport." + fileNameExtension); Response.BinaryWrite(renderedBytes); Response.End(); }
public ReportPrintDocument(ServerReport serverReport) : this((Report)serverReport) { RenderAllServerReportPages(serverReport); }
private FileContentResult RenderVisitorPass(Guid passId) { string mimeType; string encoding; string fileNameExtension; string deviceInfo = string.Empty; //The DeviceInfo settings should be changed based on the reportType //http://msdn2.microsoft.com/en-us/library/ms155397.aspx deviceInfo = "<DeviceInfo>" + " <OutputFormat>PDF</OutputFormat>" + " <PageWidth>10in</PageWidth>" + " <PageHeight>14in</PageHeight>" + " <MarginTop>0.5in</MarginTop>" + " <MarginLeft>0.5in</MarginLeft>" + " <MarginRight>0.5in</MarginRight>" + " <MarginBottom>0.5in</MarginBottom>" + " <ColumnSpacing>0.5in</ColumnSpacing>" + "</DeviceInfo>"; Warning[] warnings; string[] streams; byte[] renderedBytes = null; // //Render the report ServerReport visitorPassReport = new ServerReport(); var report_server = System.Configuration.ConfigurationManager.AppSettings["report_server"]; Uri reportServer = new Uri(report_server); visitorPassReport.ReportServerUrl = reportServer; visitorPassReport.ReportPath = "/bio/visitorpass"; //string.Format(@"/bio/visitor", reportName); IList<ReportParameter> reportParameters = new List<ReportParameter>(); visitorPassReport.SetParameters(GetReportParameters("pPassId," + passId.ToString())); renderedBytes = visitorPassReport.Render( "PDF", deviceInfo, out mimeType, out encoding, out fileNameExtension, out streams, out warnings); return new FileContentResult(renderedBytes, mimeType); }
public ReportPrintDocument(ServerReport serverReport,bool isLanscape) : this((Report)serverReport,isLanscape) { RenderAllServerReportPages(serverReport); }
private IEnumerable<ReportParameter> GetReportParameters(ServerReport serverReport) { var serverParameters = serverReport.GetParameters(); var parameterNames = serverParameters.Select(p => p.Name); return (from string key in this.Request.Params.Keys let parameterValue = HttpUtility.UrlDecode(Request.Params[key]) let serverParameter = serverParameters[key] where parameterNames.Contains(key) select serverParameter.MultiValue ? new ReportParameter(key, parameterValue.Split(',')) : new ReportParameter(key, parameterValue)) .ToList(); }