mercredi 1 avril 2015

C# ServerReport Render using rs:PersistStreams and rs:GetNextStream on WinForms

I'm developing a Winforms desktop Application and I'm using rs:PersistsStreams and GetNextStream to render my ServerReport to Image, but it is not always successful, for the same parameter, sometimes I could get only 1 page, but the other times i get 2 pages. Below the code i use to render the report:



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");
m_streams = new List<Stream>();
string mimeType, filenameExtension;

Stream pageStream = report.Render("Image", deviceInfo, firstPageParameters, out mimeType, out filenameExtension);
while(pageStream.Length > 0)
{
m_streams.Add(pageStream);
pageStream = report.Render("Image", deviceInfo, nonFirstPageParameters, out mimeType, out filenameExtension);
}


My question, why it is not getting the same result although using the same parameter? is there any way that I could use to check render status when using rs:GetNextStream?


Thanks and Best Regards Regan


Aucun commentaire:

Enregistrer un commentaire