EDN Admin
Well-known member
<p dir=ltr style="margin-right:0px Hi
<p dir=ltr style="margin-right:0px I am using SSRSs web service to get the report in a byte[].
<p dir=ltr style="margin-right:0px My report gives me report for one record. I have to loop thru multiple records then need to pass the parameter to reporting webservice which gives me byte[] for a particular record.
<p dir=ltr style="margin-right:0px I am storing those bytes in to generic list. <font size=2>
<p dir=ltr style="margin-right:0px </font><font color="#2b91af" size=2><font color="#2b91af" size=2>List</font></font><font size=2><</font><font color="#2b91af" size=2><font color="#2b91af" size=2>Byte</font></font><font size=2>[]> <font size=2>BRCOffers</font>; </font>
<p dir=ltr style="margin-right:0px Now I am trying to create the .pdf file which will have all this results.
<p dir=ltr style="margin-right:0px So I am looping thru the list and trying to append bytes to pdf file. <font size=2>
<p dir=ltr style="margin-right:0px </font><font color="#0000ff" size=2><font color="#0000ff" size=2>for</font></font><font size=2> (</font><font color="#0000ff" size=2><font color="#0000ff" size=2>int</font></font><font size=2> i = 0; i < BRCOffers.Count; i++)
<p dir=ltr style="margin-right:0px {
<blockquote dir=ltr style="margin-right:0px
<p dir=ltr style="margin-right:0px </font><font size=2><font color="#000000" size=2> fs = new FileStream(@"\SE755_VISTATestReport122.pdf", FileMode.Append);</font></font><font size=2><font color="#000000 </font>
<p dir=ltr style="margin-right:0px </font><font size=2><font color="#000000" size=2> if (i == 0)</font></font><font size=2>
<p dir=ltr style="margin-right:0px </font><font size=2><font size=2><font color="#000000 { fs.Write(BRCOffers,0, BRCOffers.Length); }</font>
<p dir=ltr style="margin-right:0px </font></font><font size=2><font color="#000000 </font>
<p dir=ltr style="margin-right:0px <font color="#000000 </font>
<p dir=ltr style="margin-right:0px </font><font size=2><font size=2><font color="#000000 else</font>
<p dir=ltr style="margin-right:0px </font></font><font size=2><font color="#000000 </font>
<p dir=ltr style="margin-right:0px </font><font color="#008000" size=2><font color="#008000" size=2><font color="#000000 { fs.Write(BRCOffers, prevOffset, BRCOffers.Length);}</font>
<p dir=ltr style="margin-right:0px </font></font><font size=2> </font><font size=2>
<p dir=ltr style="margin-right:0px prevOffset = prevOffset + BRCOffers.Length; </font><font color="#008000" size=2><font color="#008000" size=2>
<p dir=ltr style="margin-right:0px </font></font><font size=2>
<p dir=ltr style="margin-right:0px </font><font color="#008000" size=2><font color="#008000" size=2><font color="#000000 fs.Close();</font>
<p dir=ltr style="margin-right:0px </font></font><font size=2> </blockquote>
<p dir=ltr style="margin-right:0px }
<p dir=ltr style="margin-right:0px </font>
<p dir=ltr style="margin-right:0px But I am getting the following error in the second run i.e when it goes to else part
<p dir=ltr style="margin-right:0px Error: Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection.
<p dir=ltr style="margin-right:0px
<p dir=ltr style="margin-right:0px Can anybody help me out ?
<p dir=ltr style="margin-right:0px
<p dir=ltr style="margin-right:0px Thanks <hr class="sig Gunjan
View the full article
<p dir=ltr style="margin-right:0px I am using SSRSs web service to get the report in a byte[].
<p dir=ltr style="margin-right:0px My report gives me report for one record. I have to loop thru multiple records then need to pass the parameter to reporting webservice which gives me byte[] for a particular record.
<p dir=ltr style="margin-right:0px I am storing those bytes in to generic list. <font size=2>
<p dir=ltr style="margin-right:0px </font><font color="#2b91af" size=2><font color="#2b91af" size=2>List</font></font><font size=2><</font><font color="#2b91af" size=2><font color="#2b91af" size=2>Byte</font></font><font size=2>[]> <font size=2>BRCOffers</font>; </font>
<p dir=ltr style="margin-right:0px Now I am trying to create the .pdf file which will have all this results.
<p dir=ltr style="margin-right:0px So I am looping thru the list and trying to append bytes to pdf file. <font size=2>
<p dir=ltr style="margin-right:0px </font><font color="#0000ff" size=2><font color="#0000ff" size=2>for</font></font><font size=2> (</font><font color="#0000ff" size=2><font color="#0000ff" size=2>int</font></font><font size=2> i = 0; i < BRCOffers.Count; i++)
<p dir=ltr style="margin-right:0px {
<blockquote dir=ltr style="margin-right:0px
<p dir=ltr style="margin-right:0px </font><font size=2><font color="#000000" size=2> fs = new FileStream(@"\SE755_VISTATestReport122.pdf", FileMode.Append);</font></font><font size=2><font color="#000000 </font>
<p dir=ltr style="margin-right:0px </font><font size=2><font color="#000000" size=2> if (i == 0)</font></font><font size=2>
<p dir=ltr style="margin-right:0px </font><font size=2><font size=2><font color="#000000 { fs.Write(BRCOffers,0, BRCOffers.Length); }</font>
<p dir=ltr style="margin-right:0px </font></font><font size=2><font color="#000000 </font>
<p dir=ltr style="margin-right:0px <font color="#000000 </font>
<p dir=ltr style="margin-right:0px </font><font size=2><font size=2><font color="#000000 else</font>
<p dir=ltr style="margin-right:0px </font></font><font size=2><font color="#000000 </font>
<p dir=ltr style="margin-right:0px </font><font color="#008000" size=2><font color="#008000" size=2><font color="#000000 { fs.Write(BRCOffers, prevOffset, BRCOffers.Length);}</font>
<p dir=ltr style="margin-right:0px </font></font><font size=2> </font><font size=2>
<p dir=ltr style="margin-right:0px prevOffset = prevOffset + BRCOffers.Length; </font><font color="#008000" size=2><font color="#008000" size=2>
<p dir=ltr style="margin-right:0px </font></font><font size=2>
<p dir=ltr style="margin-right:0px </font><font color="#008000" size=2><font color="#008000" size=2><font color="#000000 fs.Close();</font>
<p dir=ltr style="margin-right:0px </font></font><font size=2> </blockquote>
<p dir=ltr style="margin-right:0px }
<p dir=ltr style="margin-right:0px </font>
<p dir=ltr style="margin-right:0px But I am getting the following error in the second run i.e when it goes to else part
<p dir=ltr style="margin-right:0px Error: Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection.
<p dir=ltr style="margin-right:0px
<p dir=ltr style="margin-right:0px Can anybody help me out ?
<p dir=ltr style="margin-right:0px
<p dir=ltr style="margin-right:0px Thanks <hr class="sig Gunjan
View the full article