Control Reference > VSPrinter Control > VSPrinter Properties > CalcParagraph Property |
Calculates the size of a paragraph, in twips, and returns results in TextWid, TextHei, X1, Y1, X2, and Y1.
[form!]VSPrinter.CalcParagraph = value As String
You can use this property to determine whether a paragraph will fit on the current page or to position graphical elements with respect to the paragraph.
To draw shaded paragraphs, see also the TextBox method.
For example, the following code renders several paragraphs of text and makes sure no paragraph is broken across page breaks:
Private Sub Command1_Click()
Dim i%, s$
s = "This is a long paragraph. A very long one, really. "
s = s & s & s & s & s & s & s & s
With VSPrinter1
.StartDoc
.SpaceAfter = "0.5in"
For i = 0 To 100
.CalcParagraph = s
If .CurrentY + .TextHei > .PageHeight - .MarginBottom Then
.NewPage
End If
.Paragraph = s
Next
.EndDoc
End With
End Sub
String