How can i overlay specific page with offset?

Posted by: ilia on 9 July 2018, 7:35 am EST

    • Post Options:
    • Link

    Posted 9 July 2018, 7:35 am EST

    Like this:

     
            Dim rpt As New rptBlank()
            rpt.Document.Pages.InsertNew(0)
            Dim rpt2 As New rptTemplate()
            rpt2.Run()
            Dim nWidth As Single = rpt2.Document.Pages(0).Width
            Dim nHeight As Single = rpt2.Document.Pages(0).Height
            Dim i As Integer, j As Integer
            For i = 0 To 3
                For j = 0 To 3
                    rpt.Document.Pages(i).Overlay(rpt2.Document.Pages(0), [b]i * nWidth[i][/i][/b], [b]j * nHeight[i][/i][/b])
                Next
            Next
    
    
  • Posted 9 July 2018, 7:42 am EST

    Dim rpt As New rptBlank()

    rpt.Document.Pages.InsertNew(0)

    Dim rpt2 As New rptTemplate()

    rpt2.Run()

    Dim nWidth As Single = rpt2.Document.Pages(0).Width

    Dim nHeight As Single = rpt2.Document.Pages(0).Height

    Dim i As Integer, j As Integer

    For i = 0 To 3

    For j = 0 To 3

    rpt.Document.Pages(0).Overlay(rpt2.Document.Pages(0), i * nWidth, j * nHeight)

    Next

    Next

  • Posted 11 July 2018, 11:37 am EST

    Hello,

    I have escalated this to our developer team and will inform you once I get any information from them.

    Thanks,

    Mohit

  • Posted 12 July 2018, 4:55 am EST

    Hello Ilia,

    It is not possible in AR through Overlay method.

    Thanks,

    Mohit

  • Posted 12 July 2018, 5:28 am EST

    Through which another way i can do this.

    In AR2 COM it possible through DrawPicture

    ```
    

    rpt.Pages(0).DrawPicture rpt2.Pages(0).Picture, nLeft, nTop, nWidth, nHeight

  • Posted 12 July 2018, 6:30 am EST

    Hello Ilia,

    You can use the “DrawImage” method in AR12. Please refer the documentation link:

    http://help.grapecity.com/activereports/webhelp/AR12/webframe.html#GrapeCity.ActiveReports.Document.v12~GrapeCity.ActiveReports.Document.Section.Page~DrawImage.html

    Also, you can refer the following link to convert the report to the image.

    https://www.grapecity.com/en/forums/ar-dev/exporting-section-report-p

    Thanks,

    Mohit

  • 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
    
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels