||Size: 81 KB
||Carl Henry Schaer
||This package includes the code to convert your reports originally developed for use with the Winprint report engine to be used with VPE. The VPE printengine is very fast and has much more features as winprint. We will name just a few of them here. RTF support, clickable objects, use images of the popular image formats, export of pages to all common image file formats, print forms and labels.
Winprint to VPE
By Carl Schaer
This package includes the code to convert your reports originally developed for use with the Winprint report engine to be used with VPE. The VPE printengine is very fast and has much more features as winprint. We will name just a few of them here. RTF support, clickable objects, use images of the popular image formats, export of pages to all common image file formats, print forms and labels.
The files Round.Pkg, Vpe3.Pkg, Vpe3Prnt.Pkg, and VWinPrnt.Pkg are used to convert Winprint reports to VPE 3.0. To implement them, put
in your Src file, and
in your report view files.
The WinReport objects should also be changed to VPE_WinReport objects.
The files VpeRpts.Src and VRpt*.* show how to do this with the Winprint sample reports.
There are three versions of VPE 3.0. The file Vpe3.Pkg containing the VPE functions and constants begins with
Define VPEDLL For Vpes32.Dll
If you have the enhanced or professional version of VPE, replace "Vpes32.Dll" with the Dll for your version.
A demo version of VPE 3.0 can be downloaded from
Not all of Winprint has been included yet. Particularly, graphics and the header types DFPageTotal and DFPageFooter have not been implemented.
One major bug that has not been resolved is that Procedure_Sections and HeaderTypes must correspond. For example, DFPageBottom does not work if it is put in Procedure_Section Subtotal1.
Many thanks are due to Peter Bosch, Matthew Davidian, and Peter Brooks who helped with debugging and suggestions.
Readme2.Txt for Vpe3prnt.Pkg Version 2.0
Many thanks are due to Peter Bosch, who implemented tables and lists and
#subpagecount# and #zerosubpagecount# and bug fixes, to Matt Davidian, who
implemented fixed bugs 1 - 3 and the enhancements SetPrinterSetupFile,
DFWriteRectRel, and the DFPrintSetup enhancement, and to Arnold Franken, who
fixed a bug in DFWriteBmp.
Support was added for:
Paper Bin Flags
Paper Size Flags
DFSelectPrinter (Only the device name parameter is used.)
DFHeaderWrap, HDR_WRAP, HDR_NOWRAP
pShowStatusPanel True | False
The default is False.
When this property is False, the preview goes immediately to VPE, allowing
the user to browse the report as it is being processed. The strings that
were sent to the status panel of Winprint now show at the bottom of the VPE
The default is "Processing"
This is the string that shows in the VPE Preview status when the preview
The default is "Finished"
This is the string that shows in the VPE Preview status when the report has
The default is "C:\Vpe.Prs"
This is the filename for the printer setup file that is used internally.
It should have a "Prs" extension.
pAdjustFontSize True | False
The default is true.
If true, the font size for numbers is diminished if the number does not
fit in the allocated space. This only effects individual numbers.
If this is not needed, set this to False since this feature increases
the processing time up to 30%.
The default is 7.
A new value, PRINT_TO_ASCII_FILE, has been defined for Output_Device_Mode
of Vpe_WinReport. pAsciiChannel is the channel for this Ascii output.
DFVOffset Number VertOffset
VertOffset - The vertical offset in the current Winprint scale.
If fonts are changed on one line, Winprint justifies the baseline of the
characters. There does not seem to be an easy way to do this in VPE, since
VPE printing is based on a rectangle starting with the upper left hand corner.
As a partial solution to this problem, I've added DFVOffset to set a vertical
offset. This applies for the rest of the line, but is zeroed at the end of
the line. The vertical offset needed can be computed using the scale on the VPE
preview. Hint: Go to a high magnification to see if the text is justified
correctly. At a 1:1 different fonts may not look aligned in the preview even
though they will print correctly.
The property Output_Device_Mode of VPE_WinReport can have the value
PRINT_TO_ASCII_FILE. This sends the output to an Ascii file and shows the
output in Notepad or the application stored under "WordPath" in
APPLICATION_LINKS of the registry.
The VPE license.
Defaults to "Print Preview".
The preview caption.
Defaults to VPE_FIXED_MESSAGES.
Flags used for opening the VPE document.
Normally, the property pNoteLength, which defaults to 100, determines whether or not text is wrapped. This can be controlled for individual items by using FONT_WRAP and FONT_NOWRAP.
Supports multiple printer setup files (e.g. separate printers for checks, invoices, forms, etc.)
Send SetPrinterSetupFile "C:\INVOICE.PRS"
An optional parameter was added to do alternate printer setup files
(e.g. for picking the printer for an alternate print setup file)
Object oInvPrinter is a Button
Set Label to "Click to Select Invoice Printer"
Set Size to 14 90
Send DFPrintSetup to WinPrintID "C:\INVOICE.PRS"
Writes a rectangle relative to the current line.
This command was developed for a report that required a checkbox in the right-most column of the report. Using DfWriteRect with DFGR_CURRLINE would have resulted in either a box that was not vertically centered within the current line and thus not aligned with the text on the line, or a box that was too big.
After testing the report, a "gray-bar" effect was also added (similar to the old 14" wide "green-bar" paper) to make the report easier to read. This consists of every other line being printed with a grey background.
The following is code from that report shows how to use DFWriteRectRel (coordinates are in inches):
get DFGetDFColor of WinPrintID 224 224 224 to iGrey
DFWriteRectRel 0.04 0 0.20 7.75 iGREY 0.01 ;
DFGR_NOWRAP iGREY DFGR_NOPOS
(DFWritePos's for report)
DFWriteRectRel 0.01 7.5 0.125 0.125 RGB_BLACK 0.01 ;
DFGR_NOWRAP RGB_WHITE DFGR_NOPOS
The first DFWriteRectRel occurs before anything is output on the current line.
The first parameter is the vertical offset from the current position. (This can be positive or negative. A positive offset indicates a position farther down the page and a negative offset indicates a position further up the page.)
An important point here is that when the first DFWriteRectRel is done, the vertical position is still set to a value based on the _prior_ line that was output. Once the DFWritePos's are executed after the DFWriteRectRel,
the current vertical position is moved down a bit because we are on a new line.
Thus, if you look at the offsets of the two commands, you might conclude that the second one prints higher up on the page because it has a smaller offset.
However, it actually prints further down on the page because the current vertical position changes (about .07" I believe) between the two commands.
Tables and Lists
DFStartTable [Height|VFREE] [Fill Color] [Frame Color] [Frame Thickness]
DFStopTable [Right Border]
DFStartList [Height|VFREE] [Fill Color] [Frame Color] [Frame Thickness]
DFStopList [Right Border]
DFStartBox [Height|VFREE] [Fill Color] [Frame Color] [Frame Thickness]
DFStopBox [Right Border]
DFStopTable draws a table with horizontal and vertical lines.
DFStopList draws frames with vertical lines (like tables but without horizontal divisions)
DFStopBox is like DFStartTable, except that the cursor position is not changed after the box is drawn, so that one can first draw the box, and then freely position the text inside the box.
Specifies the height of the cells. When it is not given or has the value VFREE, the height will be determined by the character size.
The background color of tables in WinPrint color constants (i.e. RGB_RED)
The color of table frames in WinPrint color constants.
The thickness of the frame lines (Default: 2)
Normally the table extends to the right margin of the report, but it can be made shorter by specifying the right border in cm.
A table row should always end with a Writeln.
DFStartTable // Table with single lines.
DFWritePos "AAAA" 1
DFWritePos "BBBB" 2
DFWriteLnPos "CCCC" 3
DFStartList VFREE RGB_GREY
For I from 1 to 10 // Table with 10 lines.
DFWritePos I 1
DFWritePos "BBBB" 2
DFWriteLnPos "CCCCC" 3
Tables can be in body sections and in header sections without DFBeginHeader ... DFEndHeader. Tables are ignored in DFBeginHeader sections.
Irregular tables can also be drawn by putting DFStartTable ... DFStopTable around individual cells.
DFwritePos "AAAA" 1
DFStartTable VFREE RGB_GREY
DFWriteLnPos "BBBB" 2
Here the first cell is drawn normally, while the second one is shaded gray and has a right border of 10 cm.
Note: If a FONT_LEFT or FONT_CENTER is followed by a FONT_RIGHT (explicit or implicit by printing a number): then the FONT_LEFT or FONT_CENTER must have a specified length.
- Margins set in Starting_Main_Report or Initialize_Report did not work.
- Corrected a bug with printing the frame for PageBottom on the first page.
- DFGR_CURRLINE could not be used for the Y coordinate of DFWriteRect.
- Items on the right were wrapping at the end of the page in the body section. They now wrap at the margin. Items in the header wrap at the end of the page as in Winprint.
- Bitmaps in headers did not work.
- Corrected a bug which caused incorrect colors to be printed in Windows NT.
- DFVOffset did not work in headers.
- In some circumstances an item showing on the preview would not print with some printer drivers.
- Subheaders were printing beyond the bottom of the page.
- A line could print beyond the bottom margin if the first item of the line was blank.
- The last item before a header used the header font.
- Numbers were printing at the right margin if the print command was not in order by the print location.
- pAdjustFontSize, which reduces the font size of large numbers so that they do not overlap adjacent items, did not work when the number was preceded by text.
- DFWriteLine was printing from the top of the page rather than the top of the current header.