Adds a text string specified by Text to the cell
using the font specified by Font (if present) or the table's
default font specified upstream via the Table.Font property.
More than one text string can be added to a cell via multiple calls
to AddText.
This method's parameters are almost identical to that
of Canvas.DrawText
except that the X, Y, Width and Height paramaters
are copied from this cell's respective properties.
There are 4 extra parameters specific to AddText only and not used in
Canvas.DrawText: IndentX, IndentY, VAlignment
and Expand.
Param is a PdfParam object or parameter string specifying
the following text drawing parameters.
- IndentX, IndentY (optional) - the horizontal
and vertical indents of the text relative to the cell's upper-left
corner, 0 by default. As of version 1.6.0.7, IndentY is ignored if
VAlignment is set to middle or bottom.
- Expand (optional) - if set to True,
the cell expands vertically to accommodate the entire
string being added. Side effect: cell and overall table height may change.
If set to False, the cell size is fixed
and only a portion of the string that fits will be drawn. False by default.
- Size (optional) - the font size, 10 by default.
- Alignment (optional) - horizontal text alignment, left (0) by default,
other valid values are right (1) and center (2).
- VAlignment (optional) - vertical text alignment, top (0) by default,
other valid values are bottom (1) and middle (2).
If this parameter is present and set to middle or bottom,
the IndentY parameter is ignored.
This parameter requires version 1.6.0.7 or higher.
- Rendering (optional) - font rendering, valid values described in
Section 6.1.2 - Rendering Parameter.
- Color (optional) - font color, black by default.
- Angle (optional) - angle (in degrees) by which the text should be
rotated counter-clockwise around the upper-left corner of
the bounding box.
- Spacing (optional) - the distance between individual lines of text,
1 by default.
- Tab (optional) - the size of a tab indent, 10 "space" characters by default.
- ReverseHebrewArabic (optional) - reverses the sequence of Hebrew and Arabic characters
in a string if set to True.
- Html (optional) - if set to True, the text string is
to be treated as HTML. False by default. For
more information on HTML support, see Section 6.4 - HTML Support.
If this parameter is set to True, the Alignment, Tab
and ReverseHebrewArabic parameters are ignored.
- ColorSpace, c1, c2, ..., cN (optional) -
introduced in Version 2.7 to enable colors in color spaces other than RGB or CMYK.
For more information, see Section 16.4 - Using Color Spaces with PdfTable and Other Objects.
The method returns the number
of printed characters. This number may be less than the length
of the original text string if the entire string did not fit
in the cell and Expand is set to False.
If Expand is set to True, all characters are usually printed,
except if the cell is too narrow even for a single character.
Usage:
objTable.Font = objFont;
objTable.[1, 2].AddText( "Hello World!", "expand=true" );
For more information on tables,
see Chapter 7 - Tables.
For more information on text and fonts, see
Chapter 6 - Text and Fonts.
For the full description of the DrawText method, see
Section 6.1 - Overview of Canvas.DrawText method.