Parameters | |
tx | the TEXT, |
hp | the HORIZONTAL position in units, which is updated and returned via the parameter, |
tm | the LINE TERMINATOR flag, |
p_d | the PRINT DEPTH in units, which is updated and returned via the parameter, |
alg | the ALIGNMENT, 0 = Left, 1 = Centre, 2 = Right, defaults to -1 which accepts the current page alignment, |
vp | the VERTICAL offset in units, defaults to zero, |
If the text is longer than the available page width as defined by the vertical margins and any horizontal offset set by 'hp', an error message is displayed but as much of the line will be printed as will fit on the page.
The line terminator flag is a Boolean which will terminate the text line if True. Setting it False allows further text to be added to the same line.
The alignment setting is really of little use! If you're going to add extra text on the same line, i.e. the termination flag is clear, only Left alignment can be allowed as is the case if there is already some text on the line, i.e. 'a non-zero 'hp'.
The vertical parameter, 'vp', which is set to default to zero, is an addition to the current printing depth, 'p_d', which can be used to add line spacing.
All text formating has to be carried out using the 'font' or 'set_font' methods.
Addition of formated textParameters | |
tx | the TEXT, |
p_d | the PRINT DEPTH in units, defaults to zero |
tm | the LINE TERMINATOR flag, defaults to False |
alg | the ALIGNMENT, 0 = Left, 1 = Centre, 2 = Right, 3 = Fully Justified, defaults to -1, (accept the current global alignment). |
p_l | the PART LINE length in units, optional, default = zero, |
vp | the VERTICAL offset in units, defaults to zero |
h_p | the HORIZONTAL offset in units, defaults to zero |
If the printing depth is defaulted, the current internal value will be used. If a non-zero value is entered for the parameter, the internal value is reset to this figure.
The line terminator flag is a Boolean which will terminate the line at the end of the text block if True. The default of False allows further text to be added to the same line, (See PART LINE, below).
The alignment, 'alg', defaults to -1 which means that the current page alignment is used. This is either the default of Left or that set by the 'set_align' method.
The PART LINE value is used to return the position of the text on the line at the end of a block which can then be used to complete this line with further text, provided that the termination flag was set to False. N.B. If full justification is used, the first part of such a line, (i.e. the last part of the previous section), will NOT be justified.
The vertical parameter, 'vp', which is set to default to zero, is an addition to the current printing depth, 'p_d', which can be used to add line spacing. i.e. setting it to the line height will give double line spacing.
The horizontal offset, 'h_p', is added as in INDENT from the LEFT margin. If LEFT or FULL JUSTIFICATION is used with a non-zero PART LINE value, this offset is ignored. If a NEGATIVE value is used, this is interpreted as an indent from both the LEFT and RIGHT margins.
The use of codesIf your text requires a 'back-slash' character to be displayed, just enter two, e.g. \\ There is no problem in using forward slashes.
Codes are sequential and are only reset by \n/. i.e. if you set text to italic, \i/, and later to bold, \b/, your display will be both italic and bold. To have bold without italic, you'd have to use \nb/.
The use of 'y' to select the Symbol font depends on that font being available on the machine. This is an unknown for distributed software but most machines will have 'Symbol'. The facility exists for Mathematical/Scientific text which may require these symbols and further symbols can be had by the use of code 'w' for 'WingDings' which should be available on all machines.
The text printing routines will recognise the VB constants, vbTab, vbCr, vbLf and vbCrLf although the last three will start the text for the following line at the far left of the page, (NOT at the Left margin), and the 'terminate' command is a better way to start a new line. Special characters are best entered from the keyboard using ALT plus the three or four digit code, e.g. © is given by ALT plus 0169.
The inclusion of a backspace code, 'k', is to allow the production of vertically aligned subscripts and superscripts for Maths and Science text.
e.g.
which was produced by "\y/m\ds/3\kp/n\n/" but which would now be better done as "μ\s/3\kp/n\n/"
The QB colour codes are as shown below. The colour descriptions are weird! i.e. 'Red' is a greyish red whilst 'Light Red' is red. 'White' is pale grey and 'Bright White' is white.
Code | Colour | RGB (in Hex) |
0 | Black | (0, 0, 0) |
1 | Blue | (0, 0, &H80) |
2 | Green | (0, &H80, 0) |
3 | Cyan | (0, &H80, &H80) |
4 | Red | (&H80, 0, 0) |
5 | Magenta | (&H80, 0, &H80) |
6 | Yellow | (&H80, &H80, 0) |
7 | White | (&HC0, &HC0, &HC0) |
8 | Grey | (&H80, &H80,&H80) |
9 | Light Blue | (0, 0, &HFF) |
10 | Light Green | (0, &HFF, 0) |
11 | Light Cyan | (0, &HFF, &HFF) |
12 | Light Red | (&HFF, 0, 0) |
13 | Light Magenta | (&HFF, 0, &HFF) |
14 | Light Yellow | (&HFF, &HFF, 0) |
15 | Bright White | (&HFF, &HFF, &HFF) |
VisualBasic's default text display is positioned at the TOP and LEFT of the character bounding boxes which is not what we want so the 'SetTextAlign' API call is used to vertically position characters at the BOTTOM of the character as a Word Processor would display them.
These text addtion routines DON'T constitute a word processor. e.g. if text is displayed and then the margins or other page properties changed, the existing text display isn't altered; only that which follows the changes in your 'create_page' routine.
I'm considering the possibility of wrapping text around a graphic.
Addition of a graphicParameters | |
path | the full path graphic FILE NAME, |
gw | required WIDTH in units or as a NEGATIVE fraction of the page width, (default = 0), |
gh | required HEIGHT in units or as a NEGATIVE fraction of the page height, (default = 0), |
hh | the relative HORIZONTAL POSITION or default, (-1), to centre, |
vv | the relative VERTICAL POSITION or default, (0), for current depth plus a single line space. |
If the width, 'gw', is defaulted to zero, the width is set to that of the image. This may be too big to fit on a page and so an error message will be displayed.
If 'gh' is set to its default, the graphic height is set to keep the proportions of the original, which will be the usual situation. Therefore, defaulting both 'gw' and 'gh' will display the graphic at its original size.
The negative values for fractions of the page width and height are required as fractional unit values might be used when the units are set to inches.
Header and footer textOne routine is used for both operations.
Parameters | |
flg | the flag, 0 = Header, 1 = Footer, |
ltx | LEFT text, |
ctx | CENTRE text, |
rtx | RIGHT text, |
f_nm | the font NAME, |
f_sz | the font SIZE, |
f_mb | the font BOLD status. |
Any of the three items of text can be omitted as can the font data. In the latter case, the default settings are used.
Specialist data can be displayed by using the following codes,
"pa" | Displays the page number using ARABIC numerals preceeded by "Page " |
"pr" | Displays the page number using lower case ROMAN numerals |
"sd" | Displays the date in the form '22/3/07' |
"ld" | Displays the date in the form '22nd March, 2007' |
No check is made to see if the three pieces of text overlap!
There is also no check made that your specified footer margin won't push the depth of the text off the bottom of a page. It isn't possible to do this because it isn't known what size of font you're going to use for the footer text. In 'preview' mode, too great a depth for the footer will just result in it vanishing. However, when printing, this can lead to a situation where tens of printed pages will be generated, so beware!