Problem compiling multipage reports

Stimulsoft Reports.NET discussion
Post Reply
spv123
Posts: 26
Joined: Mon Oct 02, 2006 8:07 am
Location: Sheffield, UK

Problem compiling multipage reports

Post by spv123 »

I'm compiling multipage reports from a report template, by loading in each page, rendering it and then copying it together. Something is going wrong because whilst the first page prints ok, the second and subsequent pages print very small compared to the first (an A4 page shrunk by about 75%!)

My code to generate the report is as below, can anybody see what I've done wrong ?

Thanks
Simon

Code: Select all

Private Function CreateStimulReport(ByVal FormName As String, ByVal FieldNames() As String, ByVal FieldData() As String)
        ' Create and Return Report

        Dim tmpReport(0) As Stimulsoft.Report.StiReport
        tmpReport(0) = New Stimulsoft.Report.StiReport

       
        tmpReport(0).Load("c:\dms\forms\" & FormName & ".mrt")
        Dim PageNo As Int32 = 0
        Dim dct As Int32 = FieldNames.GetLength(0) - 1
        For cnt As Int32 = 0 To dct

            If FieldNames(cnt) = "@PAGE" Then
                ' Create New Page
                If tmpReport(PageNo).Pages.Count > 0 Then
                    tmpReport(PageNo).Compile()
                    tmpReport(PageNo).Render()
                    If PageNo > 0 Then tmpReport(0).RenderedPages.AddRange(tmpReport(PageNo).RenderedPages)
                    ReDim Preserve tmpReport(tmpReport.GetLength(0))
                    PageNo = PageNo + 1
                    tmpReport(PageNo) = New Stimulsoft.Report.StiReport
                    tmpReport(PageNo).Load("c:\dms\forms\" & FormName & ".mrt")

                End If
            Else

                Try
                    Debug.WriteLine("Setting Field [" & FieldNames(cnt) & "] = " & FieldData(cnt))
                    If FieldData(cnt).StartsWith(" ") Then FieldData(cnt) = Chr(30) & FieldData(cnt)
                    tmpReport(PageNo).Dictionary.Variables(FieldNames(cnt)).Value = FieldData(cnt).TrimEnd(" ")
                Catch
                    Debug.WriteLine("Err with field & " & FieldNames(cnt) & "  = " & Err.Description)
                End Try
            End If

        Next
        Try
            If tmpReport(PageNo).Pages.Count > 0 Then

                tmpReport(PageNo).Compile()
                tmpReport(PageNo).Render()
                If PageNo > 0 Then tmpReport(0).RenderedPages.AddRange(tmpReport(PageNo).RenderedPages)
            End If
        Catch
            MsgBox("error = " & Err.Number & " " & Err.Description)
        End Try

        ' tmpReport(0).Show()
        Return tmpReport(0)
    End Function
Vital
Posts: 1278
Joined: Fri Jun 09, 2006 4:04 am

Problem compiling multipage reports

Post by Vital »

Please send to support [at] stimulsoft [dot] com what you receive in pdf format.

Thank you.
Post Reply