for an intern report I needed a checkered sheet. Attached is the code I use.
EasyReport is very powerful.
- Code: Select all Expand view RUN
function f_druck( cDbf )
local oVRD
local lPreview := .t.
local cDruckerName := ""
local I := 0
local cTempRow := ""
*----------------------------------------------------------
#define ER_AR_Rechnungskopf_v01 1
#define ER_AR_Invoice_v03 3
#define ER_AR_Schatten_v05 5
#define ER_AR_Linie_v04 4
#define ER_AR_Linievertikal_v06 6
#define ER_AR_Rahmen_v07 7
TPreview():lListViewHide := .T.
EASYREPORT oVRD NAME ".\xVrd2\invoice.vrd" PREVIEW lPreview TO cDruckerName;
PRINTDIALOG IIF( lPreview, .F., .F. ) MODAL
PRINTAREA ER_AR_Rechnungskopf_v01 OF oVrd
PRINTAREA ER_AR_Schatten_v05 OF oVRD
cTempRow := ALLTRIM( STR( oVRD:nNextRow - 3 ) )
For I := 1 to 17
PRINTAREA ER_AR_Linie_v04 OF oVRD
NEXT
WritePProString( "General", "Top1", cTempRow , ".\xVRD2\invoice.v07" )
PRINTAREA ER_AR_Rahmen_v07 OF oVRD
WritePProString( "General", "Top1", cTempRow , ".\xVRD2\invoice.v06" )
PRINTAREA ER_AR_Linievertikal_v06 OF oVRD
PRINTAREA ER_AR_Invoice_v03 OF oVRD
oVRD:End()
#UNDEF ER_AR_Rechnungskopf_v01
#UNDEF ER_AR_Invoice_v03
#UNDEF ER_AR_Schatten_v05
#UNDEF ER_AR_Linie_v04
#UNDEF ER_AR_Linievertikal_v06
#UNDEF ER_AR_Rahmen_v07
return nil
The design of EasyReport is made the way that you have to use numeric values in the configuration file for areas and items.
The configuration files are INI-files. You can use WritePProString and GetPvProfString.
Every PRINTAREA is stored in a single file.
In the REPORT Definition file ReportName.vrd is a key
[Areas] where you see a list with the PRINTAREA files of this report
1=invoice.v01
2=invoice.v02
3=invoice.v03
4=invoice.v04
5=invoice.v05
6=invoice.v06
7=invoice.v07
Area and Item method use numeric values.
For me the best solution to get a readable source code is to use defines (#define).
PRINTAREA 1 OF oVrd is not very userfriendly.
-----------------------------------------------------------------------------
I define the Print Areas and Items
#define ER_AR_Rechnungskopf_v01 1
and use
PRINTAREA ER_AR_Rechnungskopf_v01 OF oVrd
ER_AR_ I use for example for print area
Rechnungskopf is the task what the area prints
v01 for the configuration file.
This is helpful to find the corresponding configuration file. Many times I edit the vrd files with my text Editor (FE). This is for some tasks easier and faster.
A short explanation of what I am doing.
1) In my code before the checkered sheet is printed I store the row from the pervious AREA .
cTempRow := ALLTRIM( STR( oVRD:nNextRow - 3 ) )
( oVRD is the REPORT object with all printing Information. Please look into vrd.prg and itemvrd.prg from EasyReport ).
2) Here I change the Top1 value of the PRINTAREA. I print one layer (printarea) over the other.
First the vertical lines
WritePProString( "General", "Top1", cTempRow , ".\xVRD2\invoice.v07" )
PRINTAREA ER_AR_Rahmen_v07 OF oVRD
Then the border
WritePProString( "General", "Top1", cTempRow , ".\xVRD2\invoice.v06" )
PRINTAREA ER_AR_Linievertikal_v06 OF oVRD
Best regards,
Otto