Posted 12 July 2018, 8:58 am EST
Thanks. It works.
Imports GrapeCity.ActiveReports.Document
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim rpt As New rptBlank()
rpt.Document.Pages.InsertNew(0)
Dim rpt2 As New SectionReport1()
rpt2.Run()
Dim oPage = rpt2.Document.Pages(0)
oPage.Width = 4
oPage.Height = 3
Dim nWidth As Single = oPage.Width
Dim nHeight As Single = oPage.Height
Dim i As Integer, j As Integer
Dim bmp As Bitmap = PageToImage(oPage)
For i = 0 To 1
For j = 0 To 2
rpt.Document.Pages(0).DrawImage(bmp, nWidth * i, nHeight * j, nWidth, nHeight)
Next
Next
Viewer1.Document = rpt.Document
End Sub
Public Function PageToImage(ByRef _pg As Section.Page) As Bitmap
_pg.Units = Section.Units.Pixels
Dim bmp As Bitmap = New Bitmap(CInt(_pg.Width), CInt(_pg.Height))
Dim g As Drawing.Graphics = Drawing.Graphics.FromImage(bmp)
g.FillRectangle(New SolidBrush(Color.White), 0, 0, bmp.Width, bmp.Height)
_pg.Draw(g, New RectangleF(0, 0, _pg.Width, _pg.Height))
_pg.Units = Section.Units.Inches
PageToImage = bmp
End Function