Problem mit LocalReport im MemoryStream



Hallo zusammen,

ich habe ein Problem mit LocalReports unter C# mit .Net2005. Ich habe
mehrere Reports die im Hintergrund gedruckt werden sollen. Einer
dieser Reports ist 6 Seiten lang. Die Reports werden über diverse
DataSets gefüllt.
Von dem 6 Seiten langen Report werden jedoch nur 4 Seiten
ausgedruckt.
Die 4 Seiten erhalte ich auch nur, wenn
"report.LocalReport.GetTotalPages();" benutze.
Über "Byte[] firstPage = report.LocalReport.Render("Image",
deviceInfo, out mimeType, out encoding, out extension, out streamIDs,
out warnings); erhalte ich im streamsID nur ZERO length.

Kann mir jemand helfen, a) wie ich alle 6 Seiten gedruckt bekomme und
b) erklären, wie und warum streamsID gefüllt wird?

Zur Info: Wenn ich mir den Report im ReportViewer anschaue werden alle
6 Seiten angezeigt.

private void Export(ReportViewer report)
{
string deviceInfo =
"<DeviceInfo>" +
" <OutputFormat>EMF</OutputFormat>" +
" <PageWidth>29.7cm</PageWidth>" +
" <PageHeight>21cm</PageHeight>" +
" <MarginTop>0.1in</MarginTop>" +
" <MarginLeft>0.1in</MarginLeft>" +
" <MarginRight>0.1in</MarginRight>" +
" <MarginBottom>0.1in</MarginBottom>" +
" <StartPage>0</StartPage>" +
"</DeviceInfo>";


if (m_streams != null)
{
m_streams = null;
}
m_streams = new List<Stream>();

string encoding;
string mimeType;
string extension;
Warning[] warnings;
string[] streamIDs ; //= null;
Byte[][] pages = null;

//Create Byte array containing the rendered image. of the
1st page.
Byte[] firstPage = report.LocalReport.Render("Image",
deviceInfo, out mimeType, out encoding, out extension, out streamIDs,
out warnings);

m_streams.Add(new MemoryStream(firstPage));

// The total number of pages of the report is 1 + the
streamIDs
// int m_numberOfPages = streamIDs.Length + 1;
m_numberOfPages = report.LocalReport.GetTotalPages();
pages = new Byte[m_numberOfPages][];

// The first page was already rendered
pages[0] = firstPage;

for (int pageIndex = 1; pageIndex < m_numberOfPages;
pageIndex++)
{
// Build device info based on start page
deviceInfo = String.Format(
"<DeviceInfo>" +
" <OutputFormat>EMF</OutputFormat>" +
" <PageWidth>29.7cm</PageWidth>" +
" <PageHeight>21cm</PageHeight>" +
" <MarginTop>0.1in</MarginTop>" +
" <MarginLeft>0.1in</MarginLeft>" +
" <MarginRight>0.1in</MarginRight>" +
" <MarginBottom>0.1in</MarginBottom>" +
" <StartPage>{0}</StartPage>" +
"</DeviceInfo>", pageIndex + 1);

//Render the page to a byte array.
pages[pageIndex] = report.LocalReport.Render("Image",
deviceInfo, out mimeType, out encoding, out extension, out streamIDs,
out warnings);

//create a stream of the page's byte array
m_streams.Add(new MemoryStream(pages[pageIndex]));
//set the position of the stream to 0 to make sure
when the stream is read
//it starts from the beginning.
m_streams[m_streams.Count - 1].Position = 0;
}

m_currentPageIndex = 0;

foreach (Stream stream in m_streams)
stream.Position = 0;
}


Vielen Dank in voraus

Gruß

Tom
.



Relevant Pages

  • XLANGPart.LoadFrom(stream) failing - UnauthorizedAccessException
    ... My component then generates a PDF stream using Crystal Reports, ... attempts to load the XLANGMessage's 1st data part with the stream generated ... ReportDocument report = new ReportDocument; ... Exception thrown from: segment 1, ...
    (microsoft.public.biztalk.general)
  • How to print only certain page(s) in Microsoft Reports rdlc
    ... to load it to report viewer first. ... printDoc.PrinterSettings.PrinterName = printerName; ... Stream stream = new MemoryStream; ... private void Export ...
    (microsoft.public.dotnet.framework.windowsforms)
  • Re: memcmp() checker: memory access errors
    ... I do ungetcall 256 bytes in databack to the stream ... because ungetc() can fail to push back the bytes to the input ... my 256-byte memory leak although it did not report any other error. ... Checker does not report the source-line every time. ...
    (comp.lang.c)
  • Macrovision
    ... How is my video capture driver supposed to report that the incoming signal ... in the dwFrameFlags in the stream header of every VBI packet I send. ... I also tried setting those flags in the dwFrameFlags of every video frame, ... If anyone has succeeded in reporting Macrovisionness and had it be ...
    (microsoft.public.win32.programmer.directx.video)
  • Print directly from SSRS2008
    ... I am using the following code to print a report directly from Reporting ... private void button1_Click ... private int m_currentPrintingPage; ... string deviceInfo = null; ...
    (microsoft.public.dotnet.languages.csharp)