Wordwrapping text

An important feature of PDFReport XP is the ability to "Wordwrap Text"

This means that if you want, your text will flow to a new line if it extends beyond the maximum ParagraphWidth you decided; also, it will go to a new line whenever it will be found a CrLf marker (the standard VbCrLf).

For example, we could decide to write a long product description in a box large 60 mm; to obtain this effect, just set before the properties:

  • ParagraphWidth: the maximum width allowed for a paragraph
  • ParagraphLeading: the distance between 2 lines of text.
Private Sub Command3_Click()
  Dim PDFRPT As New PDFDocument
  PDFRPT.NewPDF "Wordwrap text"
  PDFRPT.FontName = "Helvetica-Bold"
  PDFRPT.FontHeight = 14
  PDFRPT.ParagraphLeading = 10
  PDFRPT.ParagraphWidth = 60
  PDFRPT.TextOut "This is a very very very loooong _
    text indeed, isn't it? aba aba aba abababab ab _
    ab ab ab ab ab ab ab a", 10, 70
  PDFRPT.SavePDF "c:\provaocx.pdf"
End Sub

In this code you choose to have 10 mm of distance between every line; the resulting file is this: