Advanced report design

Draw functions

With draw functions you can draw text and graphic elements anywhere in the page. They are available for use in any expression, for example before print or after print. You can use the ; operator to perform more than one operation for each expression.

Draw text funtion

function TextOp(Top,Left,Width,Height:integer; Text,LFontName,WFontName:WideString;
FontSize,FontRotation,FontStyle,FontColor,Type1Font:integer;
CutText:boolean;Alignment:integer;WordWrap,RightToLeft:Boolean;
PrintStep,BackColor:integer;transparent:boolean):Boolean

Graphic operation function

function GraphicOp(Top,Left,Width,Height:integer;
DrawStyle:integer;BrushStyle:integer; BrushColor:integer;
PenStyle:integer;PenWidth:integer; PenColor:integer):Boolean

Image operation function

function ImageOp(Top,Left,Width,Height:integer;
ImageDrawStyle:integer;PixelsPerInchg:integer;
PreviewOnly:Boolean;Expression:String):Boolean

Barcode operation function

function OnBarcodeOp (Top,Left,Width,Height:integer;
Expression,DisplayFormat:WideString;BarType,Modul:Integer;Ratio,Rotation:Currency;
CalcChecksum:Boolean;BColor:Integer):Boolean;

Text height funtion, returns text height in twips

function TextHeight(Text,LFontName,WFontName:WideString;
RectWidth,FontSize,FontStyle,Type1Font:integer;
PrintStep,BackColor:integer;transparent:boolean):Boolean

SetPageSource, set page size, and paper source

function SetPageSource(QtIndex:integer;
Custom:Boolean;CustomWidth,CustomHeight,PaperSource:integer;
ForcePaperName:String;Duplex:integer):Boolean

QtIndex is the index of the paper as shown in page setup, papersource is the integer value for paper source (0=default, force paper name are integer indexes as shown in page setup, custom indexes for printers are shown in System information, Help menu.

SetPageOrientation, set page orientation

function SetPageOrientation(orientation:integer):Boolean;

Orientation is: 0-Default, 1-Portrait, 2-Landscape

Parameters

Name Meaning
Top, Left, Width, Height Position and size of the element in twips (1440 twips=1 inch)
Text Text to print, can be also a expression
LFontName, WFontName Font names for Linux and Windows
FontSize Font size
FontRotation Rotation in 1/10 degrees unit
FontStyle

A integer 0 value=no style, to add styles sum this values:

1 Bold
2 Italic
4 Underline
8 Strikeout

So a font italic bold font will be 3

FontColor, PenColor, BrushColor, BackColor

An integer value representing the color you can use hexadecimal notation with the syntax $BBGGRR

That is white is $FFFFFF, red is $RR, blue is $BB0000

FontSize Size in standard point units (1 point=1/72 inch)
Type1Font

Font for Adobe PDF export, this is an integer with the following table:

0 Helvetica
1 Courier
2 Times Roman
3 Symbol
4 ZapfDingbats
5 TrueType linked
6 TrueType embedded
CutText Cuts the text when does not fit the rectangle size
Alignment

Alignment information, 0 for default alignment or a combination (sum) of the folowing values, note you can only combine horizontal and vertical alignments:

1 Align left
2 Align right
4 Align center horizontally
8 Align top
16 Align bottom
32 Align center vertically
Wordwrap Break sentences into lines if the text does not fit horizontally
RightToLeft If True draw the text in right to left mode
Transparent If true does the background of the text is transparent and BackColor is ignored
PrintStep

Selects the font for dot matrix print drivers and text output to dot matrix printers:

0 By size
1 20 cpi
2 17 cpi
3 15 cpi
4 12 cpi
5 10 cpi
6 6 cpi
7 5 cpi
DrawStyle

Draw type for graphic operation:

0 Rectangle
1 Square
2 Round rectangl
3 Round square
4 Ellipse
5 Circle
6 Horzontal line
7 Vertical line
8 Oblique line 1
9 Oblique line 2
PenWidth Pen width in twips (0=minimum device width)
BrushStyle
0 Solid
1 Clear/Transparent
2 Horizontal pattern
3 Vertical pattern
4 Diagonal pattern 1
5 Diagonal pattern 2
6 Cross pattern
7 Diagonal cross pattern
8..15 Dense 1..7
PenStyle
0 Solid
1 Dash
2 Dot
3 Dash-Dot
4 Dash-Dot-Dot
5 Clear/Transparent
ImageDrawStyle
0 Cut
1 Stretch
2 Full
3 Mosaic
Same meaning as in TRpImage documentation
PixelsPerInch Same meaning as in TRpImage documentation
PreviewOnly Same meaning as in TRpImage documentation

Expression (for image)

This must be always a string, so if you want to print a image stored inside a field:

'YOURDATASET.YOURFIELD'

If the field contains a path to a file:

''''+'YOURDATASET.YOURFIELD'+''''

If you place a filepath directly:

'''c:\images\backgroung.bmp'''

Expression (for barcode)

This must be always a string, if you want to print a barcode stored inside a field, provide the field as a string:

'YOURDATASET.YOURFIELD'

To provide the barcode directly write

''''+'12356789012'+''''''

DisplayFormat (for barcode) The resulting expression will be formatted with this string before calculating the barcode.
BarType

Barcode type as an integer

0 2_5 interleaved
1 2_5 industrial
2 2_5 matrix
3 Code 39
4 Code 39 extended
5 128A
6 128B
7 128C
8 128
9 Code93
10 Code93 extended
11 MSI
12 Postnet
13 Code Codabar
14 EAN8
15 EAN13

 

Modul Barcode module in twips, that is the smallest bar with unit in twips.
Ratio The ratio is applied to some barcodes see documentation.
Rotation Rotation for the barcode, currently supported are 0,90,180 and 270
CalcCheckSum The barcode will calculate checksum values for some barcodes
BColor Barcode color for bars
RecWidth Rectangle width for height calculation (in twips)