vsPrint VB.Net Header Footer text do not print

Posted by: SatishMatani on 17 May 2020, 5:26 am EST

  • Posted 17 May 2020, 5:26 am EST


    I am having problem with header and footer in VSprint. The text do not show up. I have attached the full test program

    For iCnt2 = 1 To vp.PageCount
    .FontName = "Arial"
    .MarginTop = "0.5in"
    .MarginLeft = "2.0in"
    .CurrentY = .MarginTop
    .CurrentX = .MarginLeft
    InitCol = .Columns
    .Columns = 1
    .FontBold = True
    .FontSize = 10
    .CurrentX = .MarginLeft
    .Text = "T H I S I S H E A D E R"
    .FontBold = False
    .FontSize = 10
    .PenWidth = ".3mm"
    .CurrentX = .PageWidth - .MarginRight - .get_TextWidth("TEST")
    '.CurrentX = .CurrentX + 0.55 * inch
    .Text = "TEST"

    .Paragraph = ""
    .Paragraph = ""

    'print Footer
    .FontBold = False
    .FontSize = 8
    .FontItalic = True
    .MarginLeft = "0.75in"
    .CurrentX = .MarginLeft
    .CurrentY = .PageHeight - .MarginBottom + 100
    .PenWidth = ".3mm"
    .DrawLine(.CurrentX, .CurrentY, (.PageWidth - .MarginRight), .CurrentY)
    .CurrentY = .PageHeight - .MarginBottom + 120

    .CurrentX = .PageWidth - .MarginRight - .get_TextWidth("Page 1 of 99")
    .Text = "Page " & iCnt2 & " of " & .PageCount

    .Columns = InitCol
    .FontItalic = False
    End WithvpHdrFtrTest.zip
  • Replied 18 May 2020, 8:12 am EST

    Never mind. Figured it out.
    I guess I need to use .TextBox in VB.Net instead of just .Text used in VB6.
  • Replied 18 May 2020, 11:16 am EST

    No, that was not it. .Textbox and .Text are two different things.
    How does .Text work in VB.Net?
  • Replied 18 May 2020, 8:47 pm EST

    Hi Satish,

    You should use VSPrinter's Header and Footer properties for the purpose:
    vp.Header = "T H I S  I S  H E A D E R"
    vp.Footer = "Page " & .CurrentPage & " of " & .PageCount

    and, this would be enclosed between StartDoc and EndDoc methods.

    Please refer the following documentation links for detailed information on these properties:

  • Replied 19 May 2020, 1:24 am EST

    Hi Pragati,

    I have complex header that includes drawing logo, several lines and text. vp.header just does not work well with this complex header.

    Besides, the question regarding Text property still remains as I am also using that in main body in addition to Paragraph property. The Text property does not work. Please let me know how I can use Text property in VB.Net.

    Thank you and hope you are staying safe.

  • Replied 19 May 2020, 10:32 pm EST

    Hi Satish,

    Yes, I am good. Thank you for asking.
    The ActiveX wrapper adds ctl to a few properties, such as Text, so use CtlText instead. For example, this will work:
    vp.CtlText = "Test"

    Thanks. Stay safe and healthy.
Need extra support?

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

Learn More

Forum Channels