Problem using drawtext

Posted by: abjurina on 4 August 2017, 2:53 pm EST

  • Posted 4 August 2017, 2:53 pm EST


    Here's the situation:  I am printing a report that sometimes runs onto another page. What I'd like to do is when this happens, print on the first page a "Continued on Next Page" message. I have attempted to use this code to do this once I end up on the second page, however, nothing is happening:

    <font size="1">Private Sub hdrParent_BeforePrint()
        intNewPage = intNewPage + 1
        strPrevPermnum = strCurrentPermnum
        strCurrentPermnum = Me.txtID

        If strPrevPermnum <> strCurrentPermnum Then 'And Me.txtParentID.Text = "" Then
            Me.shpHideHeaderPart.Visible = False

            Me.shpHideHeaderPart.Visible = True

            Me.Pages(0).DrawText "Continued On Next Page", 6390, 75, 3810, 240

        End If

    End Sub

    I've found that I can draw on a single page (Me.canvas.drawtext "Continued on Next page", </font><font size="1">6390, 75, 3810, 240) or if I insert a canvas, it will draw on the canvas, but it will not draw on the previous page. Any suggestions and code examples would be great. I'm kind of a newbie with AR. Its AR 2.0 btw.


  • Replied 4 August 2017, 2:53 pm EST

    Thank you for your reply. The report is actually designed to be no more than two pages, if needed, so when the condition occurs, it will always want to print back on page(0). This is not occuring. The code that I posted is causing NO text to appear on the first page. I am trying to figure out why this is not happening, and what I can do to cause it to work. The closest that I have come is to insert an overlay. However, an overlay ads an extra page to the report which causes other problems.

  • Replied 4 August 2017, 2:53 pm EST

    What kind of a section is your 'hrdParent'? Have you used any debugging tools to make sure this code is executing?
  • Replied 4 August 2017, 2:53 pm EST

    The Pages collection is 0 based, so you code is telling AR to always draw on page 1, if you want it to print on something besides the first page you need to give it a reference to that page, it looks like you already have a ready made variable for this, intNewPage. So based on your code you would want something like this.

    <FONT face="Courier New" size=2> Me.Pages(intNewPage - 1).DrawText "Continued On Next Page", 6390, 75, 3810, 240</FONT>

  • Replied 4 August 2017, 2:53 pm EST

    it is a section header. I have stepped through the code via VB and the code is indeed running without any complaints from the program. Do you think that my syntax is wrong?
  • Replied 4 August 2017, 2:53 pm EST

    I am not familar with the section header, I am with Report, Page and Group headers, but not one called 'section'. Are you perhaps using the .NET 2.0 version?

    You may need to set the canvas font, size and color properties, I was thinking it was setup to black ariel by default, but you could be explicit anyway.

  • Replied 4 August 2017, 2:53 pm EST

    The section is a group header. This issue is getting frustrating. I am previewing the report in a viewer. Do you think that the viewer may be the issue?

Need extra support?

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

Learn More

Forum Channels