Example #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnLocation_Click_1(object sender, EventArgs e)
        {
            // Always retrieve the Extensions again, because the report server can be changed!

            var rs = new ReportExecutionService {
                Url = txtReportServer.Text + "/ReportExecution2005.asmx"
            };

            if (WindowsAuthorization)
            {
                rs.Credentials = CredentialCache.DefaultCredentials;
            }
            else
            {
                rs.CookieContainer = new CookieContainer();
                rs.LogonUser(Username, Password, txtReportServer.Text);
            }


            Extension[] extensions;
            // Retrieve a list of all renderingextensions.
            extensions = rs.ListRenderingExtensions();

            if (extensions != null)
            {
                var filter = "";
                foreach (var extension in extensions)
                {
                    // only add supporter extensions
                    if (!_renderExtensions.Contains(extension.Name))
                    {
                        continue;
                    }
                    var supportedExtension = (RenderExtension)_renderExtensions[extension.Name];
                    //build filter like: Acrobat (*.pdf)|*.pdf|Microsoft Excel (*.xls)|*.xls
                    if (filter.Length > 0)
                    {
                        filter += "|";
                    }
                    filter += supportedExtension.FullName + " (" + supportedExtension.Extension + ")|" + supportedExtension.Extension;
                }
                sfdReport.Filter = filter;
            }
            if (sfdReport.ShowDialog() == DialogResult.OK)
            {
                txtLocation.Text = sfdReport.FileName;
            }
        }
        private void ListrenderingExtensions(string URL)
        {
            var rs = new ReportExecutionService
            {
                Url         = URL,
                Credentials = System.Net.CredentialCache.DefaultCredentials
            };

            try
            {
                ReportExecution2005.Extension[] extensions = rs.ListRenderingExtensions();

                if (extensions != null)
                {
                    cmbFileType.Items.Clear();
                    cmbFileType.Items.AddRange(extensions);
                }
            }
            catch { }
        }
 public RSExtension[] ListRenderingExtensions()
 {
     Extension[] extensions = rs.ListRenderingExtensions();
     return((RSExtension[])Converter.Convert(extensions));
 }