Quantcast
Channel: SQL Server Reporting Services, Power View forum
Viewing all articles
Browse latest Browse all 10045

How to retrive reporting service information from a WPF application

$
0
0

Dear all

We have a WPF application where we are doing a preview of a report configure in reporting service 2014.
To show the preview of the report we are using the ReportViewer library control.

What is happening is that since we move our reporting to RSS2014, we are not able to retrive correctly report pages. It only return 1 single page while report gets more.

To retrieve report page information we are doing as below :

 Bitmap[] images = null;
            Queue<Stream> streams = new Queue<Stream>();

            Render("IMAGE", CreateImageDeviceInfo("PNG", null, null), streams);

            images = new Bitmap[streams.Count];
            for (int i = 0; i < images.Length; i++)
            {
                using (Stream input = streams.Dequeue())
                {
                    images[i] = (Bitmap)Bitmap.FromStream(input);
                }
            }

            return images;

The render method is define as below :

 /// <summary>
        /// Renders the report.
        /// </summary>
        /// <param name="format">The format into which to render the report.</param>
        /// <param name="deviceInfo">The xml data that specifies the rendering parameters.</param>
        /// <param name="streams">Returns the different streams rendered.</param>
        private void Render(string format, string deviceInfo, Queue<Stream> streams)
        {
            string mimeType = null;
            string encoding = null;
            string fileNameExtension = null;
            string[] streamIds = null;
            Warning[] warnings = null;
            byte[] data = null;


            // Render & get the first stream
            data = _report.Render(format, deviceInfo, out mimeType, out encoding, out fileNameExtension, out streamIds, out warnings);
            streams.Enqueue(new MemoryStream(data));

            // Sort the stream ids in the order of the report pages.
            Array.Sort<string>(streamIds, new Comparison<string>(RenderStreamIdComparer));

            // Retreive the following pages
            foreach (string streamId in streamIds)
            {
                data = _report.RenderStream(format, streamId, deviceInfo, out mimeType, out encoding);
                streams.Enqueue(new MemoryStream(data));
            }
        }

As you can see, each page of the report is render as an Image and what is happening is that in stream collection always return a single stream. So du ti that the stream queue from which the image is build always contains a single record but in fact my record gets 2 pages, so teh stream colelction should be 2.

What is going wrong or done differently in RSS2014 than RSS2008 causing those page count not working anymore ?

or does it has to be done differently now ?

thnaks for advise and sample which might help

regards


Viewing all articles
Browse latest Browse all 10045

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>