Class: cWinReport2
Properties | Events | Methods | Index of Classes
Provides most of the capabilities of the BasicReport class and provides the ability to use WinPrint2 to provide more-graphical reports
Hierarchy
cObject > Report > Report_DS > BasicReport > cWinReport2
Show full hierarchy and direct subclasses
- cObject
- Report
- Report_DS
- BasicReport
- cWinReport2
Library: Windows Application Class Library
Package: cWinReport2.pkg
Description
The WinReport2 class is a subclass of BasicReport. This provides most of the capabilities of the BasicReport class and provides the ability to use WinPrint2 to provide more-graphical reports (different font styles, font weights, font orientations, graphics, etc.). It does not use images for creating reports. Instead, output is specified with the WinPrint2 command extensions.
To support printing of reports in Windows (proportional) fonts. All reporting functions are supported, including nested reports. Objects of this class support all types of constraints including parent-file, full access to indexes with multi-level subsection totalling, and access to child-file records by parent-file indexes.
Smart Relates
pbSmartRelate controls whether DataDictionaries perform relates on parent tables that are not connected to the DDO (DataDictionary Object) structure. By default, this is set to True in the DataDictionary class , meaning that relates on parent tables not in the DDO structure are not performed.
The cWinReport2 Wizard
The cWinReport2 wizard in the Studio makes it easy to get started with this class and is a great learning tool. Try generating some reports using this wizard. After the report is generated, load the report and study the code.
The Constants Interface
The cWinReport2 class uses a number of constants created for use by this class and its subclasses. The constant categories are: Page Numbering ConstantsLine Output Constants (Fonts, Colors, etc.)Printer, Page, Output ConstantsEuro symbol constant
The Command Interface
The cWinReport2 class uses a number of commands created for use by this class and its subclasses. Those commands are: DFBeginHeaderDFEndHeaderDFFontDFFontSizeDFHeaderFrameDFHeaderLineCheckDFHeaderMarginDFHeaderPosDFHeaderWrapDFLineCheckDFTopMarginDFBottomMarginDFLeftMarginDFRightMarginDFSetMarginsDFWriteDFWriteBMPDFWriteEllipDFWriteLineDFWriteLnDFWriteLnPosDFWritePosDFWriteRectDFWriteXYLineReport_BreaksReport_Data_Set (obsolete)Report_Index (obsolete)Report_Main_File (obsolete)
Sample
Object oCustomer_WinPrint is a cWinReport2
Set Report_Title to "Printing Customer Names"
Set Server to Customer_dd
Set Ordering to 1
Function Starting_Main_Report Returns Integer
Integer iRetVal
Send DFSetLandscape True
Send DFSetMetrics WPM_CM
Send DFSetmargins 1 1 1 1
Forward Get Starting_Main_Report To iRetVal
End_Function
Procedure Page_Top
string sFont
integer iSize iStyle
Move "Arial" to sFont
Move 8 to iSize
Move (font_default) to iStyle
DFFont sFont
DFFontSize iSize
DFBeginHeader DFPageTop
DFHeaderPos HDR_Left
DFHeaderFrame HDR_NOFRAME
DFWriteLn ("Page:" * "#pagecount#") (iStyle+Font_Right)
DFEndHeader
End_Procedure
Procedure Page_Header
string sFont
integer iSize iStyle iFill iBorder
Move "Arial" to sFont
Move 16 to iSize
Move (font_Bold+rgb_white) to iStyle
Move (rgb_dGrey) to iFill
Move (rgb_dGrey) to iBorder
DFFont sFont
DFFontSize iSize
DFBeginHeader DFPageHeader
DFHeaderFrame HDR_MARGINs 0 iBorder iFill
DFHeaderMargin HM_BottomOuter 0.08
DFHEADERPOS HDR_LEFT
DFWritelnPos "Customer List " 0.10 (iStyle)
DFEndHeader
End_Procedure
Procedure Page_Title
Boolean bOn
string sFont
integer iSize iStyle iFill iBorder
Get pbLandscape to bOn
Move "Arial" to sFont
Move 8 to iSize
Move (font_Bold+rgb_dBlue) to iStyle
Move rgb_Grey to iFill
Move rgb_Grey to iBorder
DFFont sFont
DFFontSize iSize
DFBeginHeader DFPageTitle
DFHeaderFrame HDR_MARGINs 0 iBorder iFill
DFHeaderMargin HM_BottomOuter 0.16
DFHEADERMargin HM_TopInner 0.01
DFHEADERMargin HM_BottomInner 0.01
DFHEADERPOS HDR_LEFT
DFWritePos "Number" 0.1 (iStyle)
DFWritePos "Name" 2 (iStyle)
DFWritePos "Address" 7 (iStyle)
DFWritePos "City" 12 (iStyle)
DFWritePos "State" 15 (iStyle)
DFWritePos "Zip" 16 (iStyle)
DFWritePos "Comments" 18 (iStyle)
DFWriteln
DFEndHeader
End_Procedure
Procedure_Section Body
string sFont
integer iSize
integer iStyle
Send Update_Status (String(Customer.Customer_number))
Move "Arial" to sFont
Move 8 to iSize
Move (font_default) to iStyle
DFFont sFont
DFFontSize iSize
DFLineCheck 5
DFWritePos Customer.Customer_number 0.8 (iStyle+Font_Right) 0
DFWritePos Customer.Name 2 (iStyle) -1 4.08
DFWritePos Customer.Address 7 (iStyle) -1 4.98
DFWritePos Customer.City 12 (iStyle) -1 3.98
DFWritePos Customer.State 15 (iStyle) -1 0.98
DFWritePos Customer.Zip 16 (iStyle) -1 1.98
DFWritePos Customer.Comments 18 (iStyle) -1 0
DFWriteln
DFWriteln
End_Procedure // Body
Procedure Page_Bottom
DateTime dtDT
string sFont
integer iSize iStyle iBorder iFill
Move (CurrentDateTime()) to dtDT
Move "Arial" to sFont
Move 8 to iSize
Move rgb_dBlue to iStyle
Move rgb_dGrey to iBorder
Move rgb_White to iFill
DFFont sFont
DFFontSize iSize
DFBeginHeader DFPageBottom
DFHeaderPos HDR_LEFT
DFHeaderFrame HDR_MARGINS 0 iBorder iFill
DFWriteLn ("Report Printed on: " +string(dtDT)) (iStyle+Font_Center)
DFEndHeader
End_Procedure
End_Object // oCustomer_WinPrint
The cWinReport2 Report Sections
cWinReport2 objects use the same reports sections as the BasicReport. Each of these sections are represented in your report with a Procedure. For example, report_header will be represented inside of "Procedure report_header". All sections, except the body section will use a cWinPrint2 Header that is created within your procedure using the DFBeginHeader command. For example, the report_footer procedure will contain "DFBeginHeader DFReportHeader". The following table provides information about these report sections:
| Procedure Name | DFBeginHeader Name | Description |
|---|---|---|
| Page_top | DFPageTopPage_top is printed first at the physical top margin of each page. | |
| Report_header | DFReportHeaderReport_header is printed once in a report after Page_top. | |
| Page_header | DFPageHeaderPage_header is printed on every page following Report_Header. Note that this is different than the BasicReport behavior. | |
| Page_title | DFPageTitlePage_title appears on every page after Page_heading. | |
| SubHeader1..n | DFSubHeader 1..9Subheaders appear for each break level. They are ouput for each new break. They are usually reprinted on page breaks. | |
| Body | noneThe Body section is called once for every valid record. There is no DFHeader associated with this. | |
| SubTotal1..n | DFSubTotal 1..9Subtotals appear for each break level. They are output at the end of a break. They are normally not reprinted on page breaks. | |
| Total | DFTotalThe Total section appears once at the end of a report following all sub-totals. | |
| Report_footer | DFReportFooterReport_footer is printed once on the last page before Page_footer. | |
| Page_footer | DFPageFooterPage_footer is printed on every page before Page_bottom. Note that this is different than the BasicReport behavior. | |
| Page_bottom | DFPageBottomPage_Bottom is printed at the physical bottom margin of each page. |
Of Special Note
The WinPrint2 engine handles page breaks automatically; the only programmable page-breaking capability in this class is the DFNew_Page procedure. Where you unconditionally desire a page break in your report (as at the triggering of a certain level of section break), use DFNew_Page. A global integer ghoWinPrintID contains the object Id of the global WinPrint2 object. This is the WinPrint2 report engine. When a report is run, the global variable WinPrintID is set to this value. This is required because the same commands used in both WinPrint1 and WinPrint2 and both must send messages to WinPrintId. You should normally never need to access the global report object - if you do you should use ghoWinPrint2 or, even better, the phoWinPrint property. When report objects are nested, all subtotals for all objects are stored in the outer object. This means you don't have to keep track of which object contains each subtotal. The overall structure of this object is the same as the BasicReport object. The sections are the same, the processing is the same, and the error handling is the same. The main difference is the method of viewing and output. Output is defined with a number of special WinPrint commands. These commands are used to define font style, size, orientation, placement. Examples of these commands are DFBeginHeader, DFfEndHeader, DFFonts, DFFontSize and DFWrite. Output can be directed to a printer or to the WinPrint print preview panel. This is controlled by setting the output_device_mode property in the report view.
Constants Used By cWinReport2
The following constants are used by cWinReport2: Page Numbering ConstantsLine Output Constants (Fonts, Colors, etc.)Printer, Page, Output ConstantsEuro symbol constant
Page Numbering
In WinPrint2, three keywords used as the argument of any of the DFWrite* commands support printing page numbers. It is very important that #pagecount#, #subpagecount# and #zerosubpagecount# are written in lowercase letters and enclosed in quotation marks.
pagecount
pagecount# prints page numbers that increment from the beginning of the report to the end.
DFWriteLn '#pagecount#' (FONT_RIGHT)
DFWriteLnPos '#pagecount#' 5 (FONT_DEFAULT)
subpagecount
subpagecount# prints page numbers that increment until a #zerosubpagecount# is executed, at which point they resume incrementing from 1. #subpagecount# would typically be used in Sections pageTop and pageBottom.
DFWriteLn '#subpagecount#' FONT_DEFAULT
DFWriteLnPos '#subpagecount#' 5 FONT_DEFAULT
If you have a report printing multi-page invoices and you want each invoice to start with Page 1, then you should use #subpagecount# and zerosubpagecount#.
zerosubpagecount
zerosubpagecount# zeroes the #subpagecount# counter. You must do a #zerosubpagecount# before you create a new page. #zerosubpagecount# would typically be used in a Section subTotal or subHeader. #zerosubpagecount# must be used inside a DFBeginHeader...DFEndHeader block.
DFWrite '#zerosubpagecount#'
Because the numbering of report pages and section pages is done with different arguments, you can have a report whose pages are numbered both ways, if you wish.
Line Output Constants (Fonts, Colors, etc.)
Many of the commands in WinPrint2 use named constants as arguments. Certain arguments can only be one of the named constants. These constants include font attributes, colors, and print dialog/setup flags. Font Attributes These named constants, along with all colors, can be used in attributes in DFWrite... statements. When used more than one at a time in a statement, they should be separated by plus (+) signs and all enclosed together by a single pair of parentheses.
| Col 1 | Col 2 |
|---|---|
| FONT_DEFAULT | Font with no attributes |
| FONT_UNDER | Underline attribute |
| FONT_BOLD | Bold attribute |
| FONT_ITALIC | Italic attribute |
| FONT_STRIKE | Strikeout attribute |
| FONT_LEFT | Output left-justified to the margin, column, or position. |
| FONT_CENTER | Output centered on position, in the column, or between the margins. |
| FONT_RIGHT | Output right-justified to the margin, column, or position. |
| Colors | |
| These constants provide a convenience for outputting in various standard colors. They can be used with all commands that take color as an argument, including in attributes in DFWrite... statements. With the DFGetDFColor function, you can create any color you desire for output. |
| Regular colors | Dark colors |
|---|---|
| RGB_BLACK | |
| RGB_WHITE | |
| RGB_BLUE | RGB_DBLUE |
| RGB_CYAN | RGB_DCYAN |
| RGB_GREEN | RGB_DGREEN |
| RGB_GREY | RGB_DGREY |
| RGB_MAGENTA | RGB_DMAGENTA |
| RGB_RED | RGB_DRED |
| RGB_YELLOW | RGB_DYELLOW |
Printer, Page, Output Constants
Page Orientation Page Orientation (landscape or portrait) is controlled using the DFSetLandscape and DFGetLandscape messages. Default Paper Bin The paper bin is contolled using the DFSetPrinterBin, DFGetPrinterBin and DFPrinterBinFirstPage messages. The following bin types may be selected:
| Col 1 | Col 2 |
|---|---|
| DF_BIN_AUTO | DF_BIN_CASSETTE |
| DF_BIN_ENVELOPE | DF_BIN_ENVMANUAL |
| DF_BIN_FIRST | DF_BIN_LARGECAPACITY |
| DF_BIN_LARGEFMT | DF_BIN_LAST |
| DF_BIN_LOWER | DF_BIN_MANUAL |
| DF_BIN_MIDDLE | DF_BIN_ONLYONE |
| DF_BIN_SMALLFMT | DF_BIN_TRACTOR |
| Default Paper Size | |
| Paper size is controlled using the DFSetPrinterPaper, DFGetPrinterPaper, DFSetUserDefinedPapersize, DFGetUserDefinedLength and DFGetUserDefinedWidth messages. The following paper sizes may be selected |
| Col 1 | Col 2 |
|---|---|
| DF_PAPER_10X14 | 10 by 14 inch sheet |
| DF_PAPER_11X17 | 11 by 17 inch sheet |
| DF_PAPER_A3 | A3 sheet, 297 by 420 millimeters |
| DF_PAPER_A4 | A4 Sheet, 210 by 297 millimeters |
| DF_PAPER_A4SMALL | A4 small sheet, 210 by 297 millimeters |
| DF_PAPER_A5 | A5 sheet, 148 by 210 millimeters |
| DF_PAPER_B4 | B4 sheet, 250 by 354 millimeters |
| DF_PAPER_B5 | B5 sheet, 182 by 257 millimeter paper |
| DF_PAPER_CSHEET | C Sheet, 17 by 22 inches |
| DF_PAPER_DSHEET | D Sheet, 22 by 34 inches |
| DF_PAPER_ENV_10 | #10 Envelope, 4 1/8 by 9 1/2 inches |
| DF_PAPER_ENV_11 | #11 Envelope, 4 1/2 by 10 3/8 inches |
| DF_PAPER_ENV_12 | #12 Envelope, 4 3/4 by 11 inches |
| DF_PAPER_ENV_14 | #14 Envelope, 5 by 11 1/2 inches |
| DF_PAPER_ENV_9 | #9 Envelope, 3 7/8 by 8 7/8 inches |
| DF_PAPER_ENV_B4 | B4 Envelope, 250 by 353 millimeters |
| DF_PAPER_ENV_B5 | B5 Envelope, 176 by 250 millimeters |
| DF_PAPER_ENV_B6 | B6 Envelope, 176 by 125 millimeters |
| DF_PAPER_ENV_C3 | C3 Envelope, 324 by 458 millimeters |
| DF_PAPER_ENV_C4 | C4 Envelope, 229 by 324 millimeters |
| DF_PAPER_ENV_C5 | C5 Envelope, 162 by 229 millimeters |
| DF_PAPER_ENV_C6 | C6 Envelope, 114 by 162 millimeters |
| DF_PAPER_ENV_C65 | C65 Envelope, 114 by 229 millimeters |
| DF_PAPER_ENV_DL | DL Envelope, 110 by 220 millimeters |
| DF_PAPER_ENV_ITALY | Italy Envelope, 110 by 230 millimeters |
| DF_PAPER_ENV_MONARCH | Monarch Envelope, 3 7/8 by 7 1/2 inches |
| DF_PAPER_ENV_PERSONAL | 6 3/4 Envelope, 3 5/8 by 6 1/2 inches |
| DF_PAPER_ESHEET | E Sheet, 34 by 44 inches |
| DF_PAPER_EXECUTIVE | Executive, 7 1/4 by 10 1/2 inches |
| DF_PAPER_FANFOLD_LGL_GERMAN | German Legal Fanfold, 8 1/2 by 13 inches |
| DF_PAPER_FANFOLD_STD_GERMAN | German Std Fanfold, 8 1/2 by 12 inches |
| DF_PAPER_FANFOLD_US | US Std Fanfold, 14 7/8 by 11 inches |
| DF_PAPER_FOLIO | Folio, 8 1/2 by 13 inch paper |
| DF_PAPER_LEDGER | Ledger, 17 by 11 inches |
| DF_PAPER_LEGAL | Legal, 8 1/2 by 14 inches |
| DF_PAPER_LETTER | Letter, 8 1/2 by 11 inches |
| DF_PAPER_LETTERSMALL | Letter Small, 8 1/2 by 11 inches |
| DF_PAPER_NOTE | Note, 8 1/2 by 11 inches |
| DF_PAPER_QUARTO | Quarto, 215 by 275 millimeter paper |
| DF_PAPER_STATEMENT | Statement, 5 1/2 by 8 1/2 inches |
| DF_PAPER_TABLOID | Tabloid, 11 by 17 inches |
| DF_PAPER_USER | User defined paper size, used in conjunction with DFSetUserDefinedPapersize |
Default Printer Resolution Printer resolution is controlled using the DFSetPrinterResolution and DFGetPrinterResolution messages. The following resolutions may be selected:
| Col 1 | Col 2 |
|---|---|
| DF_RES_DRAFT | DF_RES_HIGH |
| DF_RES_LOW | DF_RES_MEDIUM |
Euro Symbol Support
In WinPrint2 a special symbol is used as the argument of any of the DFWrite* commands to support printing the Euro symbol. It is important that the #euro# symbol is written in lowercase and enclosed in a literal string. e.g. "#euro#".
Sample
DFWritePos "The Euro symbol looks like this: #euro#" 5
DFWritePos ("#euro#" + string(Customer.Balance)) 10
Commands Used by cWinReport2
The following commands are used by WinReport: DFBeginHeaderDFEndHeaderDFFontDFFontSizeDFHeaderFrameDFHeaderLineCheckDFHeaderMarginDFHeaderPosDFHeaderWrapDFLineCheckDFTopMarginDFBottomMarginDFLeftMarginDFRightMarginDFSetMarginsDFWriteDFWriteBMPDFWriteEllipDFWriteLineDFWriteLnDFWriteLnPosDFWritePosDFWriteRectDFWriteXYLineReport_BreaksReport_Data_Set (obsolete)Report_Index (obsolete)Report_Main_File (obsolete)
DFBeginHeader
Purpose DFBeginHeader starts the definition of section headers and footers in the output. Syntax DFBeginHeader {header-type} [{level#}]
| Argument | Type | Explanation | Constant | Meaning |
|---|---|---|---|---|
| Header-type | constant Type of Header. Must be one of thefollowing constantsConstantMeaning | |||
| DFReportHeader | Once only, at beginning of report | |||
| DFPageTop | Page top | |||
| DFPageTitle | Page title | |||
| DFPageHeader | Page header | |||
| DFPageHeader2 | Page header (all pages except first) | |||
| DFSubHeader | Section breaks, levels 1-9 | |||
| DFSubTotal | Section breaks, levels 1-9 | |||
| DFTotal | Total | |||
| DFPageFooter | Page footer | |||
| DFPageTotal | Page total | |||
| DFPageBottom | Page bottom | |||
| DFReportFooter | Once only, at end of report | |||
| level# | integer Section level number (only used with DFSubHeader or DFSubTotal) |
If you use Header Type DFSubHeader or DFSubTotal, level# is required. If you are defining a SubHeader1, the level# is 1, if you are defining a SubTotal2, level# is 2, and so on. In nested reports, level# should be the level of the overall report, not that of the nested report.
Do not nest the definitions of section headers and footers.
DFBeginHeader DFSubHeader 1
DFHeaderWrap HDR_NOWRAP
DFHeaderPos HDR_LEFT
DFHeaderFrame HDR_MARGINS
DFWritePos Customer.Recnum 0.5 (FONT_ITALIC +FONT_BOLD +RGB_RED) 1.5
DFWritelnPos Customer.Customer 2 (FONT_ITALIC +FONT_BOLD)
DFEndHeader
DFEndHeader
Purpose DFEndHeader ends a section header or footer begun with DFBeginHeader. Syntax DFEndHeader
DFBeginHeader DFSubHeader 1
DFHeaderWrap HDR_NOWRAP
DFHeaderPos HDR_LEFT
DFHeaderFrame HDR_MARGINS
DFWritePos Customer.Recnum 0.5 (FONT_ITALIC +FONT_BOLD +RGB_RED) 1.5
DFWritelnPos Customer.Customer 2 (FONT_ITALIC +FONT_BOLD)
DFEndHeader
DFFont
Purpose DFFont sets the default font to any valid Windows font. Syntax DFFont {fontname}
| Argument | Type | Explanation |
|---|---|---|
| fontname | string Any font valid in the Windows installation |
DFFont sets the default font to any valid Windows font. The font remains active until you change it to another font with this command.
DFFont 'Arial'
DFFont 'Times New Roman'
DFFontSize
Purpose DFFontSize sets the font size to any valid size for that font Syntax DFFontSize {height}
| Argument | Type | Explanation |
|---|---|---|
| height | number Height of font in points |
DFFontSize sets the font size to any valid size for that font. The size remains active until you change it to another size with this command.
DFFontSize 14
DFHeaderFrame
Purpose DFHeaderFrame sets the frame style of a header or footer section. Syntax DFHeaderFrame {style} [{border_width} [{border_color} [{fill_color}]]]
| Argument | Type | Explanation | Constant | Meaning |
|---|---|---|---|---|
| style | constant Frame style. Must be one of the following constants.ConstantMeaning | |||
| HDR_FRMSIZE | Fit to data | |||
| HDR_MARGINS | Left-margin-to-right-margin | |||
| HDR_NOFRAME | No frame | |||
| border_width | number Optional. Width of border (using current metrics) | |||
| border_color | numberOptional. Border Color | |||
| fill_color | consant Optional. Fill Color |
DFHeaderFrame may be used only inside a header or footer section begun with dfBeginHeader.
DFBeginHeader DFSubHeader 1
DFHeaderPos HDR_LEFT
DFHeaderFrame HDR_MARGINS 0.1 RGB_BLACK RGB_CYAN
DFWritePos Customer.Recnum 0.5 (FONT_ITALIC +FONT_BOLD)
DFWriteLnPos Customer.Customer 2 (FONT_ITALIC +FONT_BOLD)
DFEndHeader
DFHeaderLineCheck
Purpose DFHeaderLineCheck specifies that the header plus a specified number of lines fits on a page. Syntax DFHeaderLineCheck {lines}
| Argument | Type | Explanation |
|---|---|---|
| lines | integer Number of lines to check (in addition to the header) |
Whenever a header is triggered, it automatically checks the current page to ascertain whether there is room on that page for the whole header. If not, the header will be printed on a new page. DFHeaderLineCheck enables you to specify that this check be performed for the header plus whatever number of lines you feel your program requires for a meaningful beginning of a new section. This command may be used only inside a header section begun with DFBeginHeader.
Number of lines will be checked according the font and size last used.
DFBeginHeader DFSubHeader 1
DFHeaderLineCheck 4
DFHeaderPos HDR_LEFT
DFHeaderFrame HDR_MARGINS
DFWritePos Customer.Recnum 0.5 (FONT_ITALIC +FONT_BOLD) 1.5
DFWriteLnPos Customer.Customer 2 (FONT_ITALIC +FONT_BOLD)
DFEndHeader
DFHeaderMargin
Purpose DFHeaderMargin sets inner and outer padding for top and bottom margins in a header Syntax DFHeaderMargin ePadPosition nPadding
| Argument | Type | Explanation | Constant | Meaning |
|---|---|---|---|---|
| ePadPosition | constant Location for paddingConstantMeaning | |||
| HM_TopOuter | Top outside of header frame | |||
| HM_TopInner | Top inside of header frame | |||
| HM_BottomInner | Bottom inside of header frame | |||
| HM_BottomOuter | Bottom outside of header frame | |||
| nPaddding | number Amount of space (padding) in current metrics. |
Normally the outside padding of a frame is 0 and the inside padding of a frame is created based on the size of the header's font. DFHeaderMargin allows you to specify the exact space at the top and bottom of a header. You can specify padding outside and inside of a header frame.
Setting a value to zero, restores the default. Therefore 0.01 is the smallest padding you can specify.
The Hm_BottomOuter is a particularly useful setting.
DFBeginHeader DFSubHeader 1
DFHeaderLineCheck 4
DFHeaderPos HDR_LEFT
DFHeaderFrame HDR_MARGINS
DFHeaderMargin HM_TopOuter 0.04
DFHeaderMargin HM_TopInner 0.01
DFHeaderMargin HM_BottomInner 0.01
DFHeaderMargin HM_BottomOuter 0.10
DFWritePos Customer.Recnum 0.5 (FONT_ITALIC +FONT_BOLD)
DFWriteLnPos Customer.Customer 2 (FONT_ITALIC +FONT_BOLD)
DFEndHeader
DFHeaderPos
Purpose DFHeaderPos positions the section header according to a justification mode Syntax DFHeaderPos {justification}
| Argument | Type | Explanation | Constant | Meaning |
|---|---|---|---|---|
| justification | constant Justification mode. Must be one of the following constantsConstantMeaning | |||
| HDR_LEFT | Justify the header or footer to the left margin | |||
| HDR_RIGHT | Justify the header or footer to the right margin | |||
| HDR_CENTER | Center the header or footer between the margins |
DFHeaderPos positions the section header or footer according to the value of justification. DFHeaderPos may be used only inside a header section (a section begun by DFBeginHeader).
Unless you are using HDR_FRMSIZE as your frame style, it is suggested that you always set DFHeaderPos to HDR_LEFT. This will allow you to justify text within the entire width of the page using FONT_LEFT, FONT_CENTER and FONT_RIGHT.
DFBeginHeader DFSubHeader 1
DFHeaderWrap HDR_NOWRAP
DFHeaderPos HDR_LEFT
DFHeaderFrame HDR_FRMSIZE
DFWritePos Customer.Recnum 0.5 (FONT_ITALIC +FONT_BOLD) 1.5
DFWritePos Customer.Customer 2 (FONT_ITALIC +FONT_BOLD)
DFWriteLn Customer.Address (FONT_ITALIC +FONT_BOLD+FONT_RIGHT)
DFEndHeader
DFHeaderWrap
Purpose DFHeaderWrap tells a header section to reprint at the top of the new page Syntax DFHeaderWrap {wrap}
| Argument | Type | Explanation | Constant | Meaning |
|---|---|---|---|---|
| wrap | constant Wrap mode. Must be one of the following constants.ConstantMeaning | |||
| HDR_NOWRAP | Header is not printed on new pages | |||
| HDR_WRAP | Header is printed on new pages |
DFHeaderWrap tells a header section to reprint at the top of the new page if a page break occurs within the section's data (before the beginning of the next section). DFHeaderWrap may be used only inside a header section begun with DFBeginHeader, and has no effect in footer-section definitions. By default, sub-headers wrap and sub-totals do not.
DFBeginHeader DFSubHeader 1
DFHeaderWrap HDR_NOWRAP
DFHeaderPos HDR_LEFT
DFHeaderFrame HDR_MARGINS
DFWritePos Customer.Recnum 0.5 (FONT_ITALIC +FONT_BOLD)
DFWriteLnPos Customer.Customer 2 (FONT_ITALIC +FONT_BOLD)
DFEndHeader
This command may be used only in a header or footer section begun by DFBeginHeader.
DFLineCheck
Purpose DFLineCheck checks that a given number of lines fit on the page Syntax DFLineCheck {lines}
| Argument | Type | Explanation |
|---|---|---|
| lines | integer Number of lines to check for |
DFLineCheck checks that a given number of lines fit on the page. If not, a page break will be done. It is very useful where the record body has more than one line, to ensure that no record is split by a page break.
Number of lines is checked for the font and size last used in the program.
DFLineCheck 3
DFWriteLnPos Customer.Recnum 2 (FONT_ITALIC +FONT_BOLD)
DFWriteLnPos Customer.Customer 2 (FONT_ITALIC +FONT_BOLD)
DFWriteLnPos Customer.Address 2 (FONT_ITALIC +FONT_BOLD)
The DF MarginCommands
DFLeftMargin DFTopMargin DFRightMargin DFBottomMargin Send DFSetMargins Purpose The DF Margin commands set the margins of your document Syntax DFTopMargin {position} DFBottomMargin {position} DFLeftMargin {position} DFRightMargin {position}
| Argument | Type | Explanation |
|---|---|---|
| position | number Margin in the current metrics |
The DF Margin commands set the margins of your document using the current metrics, specified by the value of dfCurrent_metrics in the WinPrint Global Object. The default metrics is centimeters and all margins are set to 2.53cm as default. 2.53cm equals 1inch. You cannot set the margins for individual pages. The margins you have set will be valid for all pages of the report.
You can set all margins at one time by calling the procedure DFSetMarginsand passing the values for left, top, right, and bottom in that order.
DFTopMargin 1.25
DFBottomMargin 1.25
Send DFSetMargins nLeft nTop nRight nBottom
All the position measurements (vert, horz, etc.) of the other commands are taken vertically down from the top margin and horizontally right from the left margin.
DFWrite
Purpose DFWrite appends data to the current line Syntax DFWrite {variable} [{attributes} [{decimal-places}]]
| Argument | Type | Explanation |
|---|---|---|
| variable | string A literal, variable, or database field whose value is to be output | |
| attributes | constant Optional. Font attributes and colors | |
| decimal_places | integer Optional. Number of digits to the right of the decimal for numeric values |
If you use decimal_places, you must use all preceding arguments. If you use this argument, the output will be displayed with the number of decimal digits specified, right-justified to the page/header.
If you use FONT_LEFT, FONT_CENTER or FONT_RIGHT in attributes, the output will be justified to the page/header.
DFWrite "Balance" (FONT_ITALIC +FONT_BOLD +RGB_RED)
DFWrite product.description (FONT_DEFAULT)
DFWrite 12345.67 (FONT_ITALIC +RGB_BLUE) 2
DFWriteBMP
Purpose DFWriteBMP is used to place an image on the page. DFWriteBMP supports .BMP (standard Windows bit-mapped graphics format), .RLE (run-length encoded graphics), .JPG/.JPEG (Joint Photographic Experts Group graphics), .ICO (icon files), .WMF (Windows meta files) and .EMF (extended/enhanced Windows meta files). Syntax DFWriteBMP {path\filename} {vert_Location} {horz_Location} {height} {width} [{update_cur_pos}]
| Argument | Type | Explanation | Constant | Meaning |
|---|---|---|---|---|
| path\filename | string Name and path of image file | |||
| vert | numberLocation (upper-left corner) vertical coordinate. DFGR_CURRLINE= current line position | |||
| horz | numberLocation (upper-left corner) horizontal coordinate. DFGR_CURRLINE= current line position | |||
| vert_Location | number (upper-left corner) vertical coordinate in the current metrics | |||
| horz_Location | number (upper-left corner) horizontal coordinate in the current metrics | |||
| height | number Height of bitmap in the current metrics | |||
| width | number Width of bitmap in the current metrics | |||
| update_cur_pos | constant Optional. Determines where current position pointer will be placedConstantMeaning | |||
| DFGR_SETPOS | Move current position to end of bitmap | |||
| DFGR_NOPOS | Leave current position unchanged |
Path is only required if the bitmap is not in the same directory as the application.
The vertical and horizontal start positions use current metrics for the position on the page. Height and width of the bitmap also use current metrics.
Position is from the margin.
DFWriteBMP 'UGLYFACE.BMP' 2 10 4 3 DFGR_NOPOS
DFWriteBMP "logo.jpg" 14 7 12 9 DFGR_NOPOS
DFWriteEllip
Purpose DFWriteEllip writes an ellipse to the page. Syntax DFWriteEllip {vert} {horz} {height} {width} [{border_color} [{border-width} [{reprint} [{fill_color} [{update_cur_pos}]]]]]
| Argument | Type | Explanation | Constant | Meaning | Constant | Meaning |
|---|---|---|---|---|---|---|
| vert | number Location (upper-left corner) vertical coordinate in the current metrics. DFGR_CURRLINE= current line position | |||||
| horz | number Location (upper-left corner) horizontal coordinate in the current metrics. DFGR_CURRLINE= current line position | |||||
| height | number Height of the ellipse in the current metrics. DFGR_RB_MARGIN = height of entire header | |||||
| width | number Width of the ellipse in the current metrics. DFGR_RB_MARGIN = width of header / width of page | |||||
| border_color | constant Optional. Border lines color (default black) | |||||
| border_width | constant Optional. Width of border lines in the current metrics | |||||
| reprint | constant Optional. Determines if graphic is reprinted in succeeding pageConstantMeaning | |||||
| DFGR_NOWRAP | Print once only | |||||
| DFGR_WRAP | Print on each succeeding page | |||||
| fill_color | constant Optional. Fill color(default transparent) | |||||
| update_cur_pos | constant Optional. Determines where current position pointer will be placedConstantMeaning | |||||
| DFGR_SETPOS | Move current position to end of ellipse | |||||
| DFGR_NOPOS | Leave current position unchanged |
DFGR_RB_MARGIN refers to the full distance between the top and bottom margins or the left and right margins, as appropriate. DFGR_CURRLINE refers to the current line position
DFWriteEllip 2 4 6 4 RGB_BLACK 0.1 DFGR_NOWRAP RGB_RED DFGR_NOPOS
DFWriteEllip 0 0 DFGR_RB_MARGIN DFGR_RB_MARGIN 0.3
DFWriteLine
Purpose DFWriteLine is used to output a graphic line (rule) to a page. Syntax DFWriteLine {vert} {horz} {length} [{orientation} [{color} [{width} [{update_cur_pos}]]]]
| Argument | Type | Explanation | Constant | Meaning | Constant | Meaning |
|---|---|---|---|---|---|---|
| vert | number Location (upper or left end) vertical coordinate in the current metrics. DFGR_CURRLINE= current line position | |||||
| horz | number Location (upper or left end) horizontal coordinate in the current metrics. DFGR_CURRLINE= current line position | |||||
| length | number Length of line in the current metrics. DFGR_RB_MARGIN = height/width of entire header/page as appropriate. | |||||
| orientation | constant Optional. Determines if line is horizontal of vertical.ConstantMeaning | |||||
| DFGR_HORI | Horizontal line (default) | |||||
| DFGR_VERT | Vertical line | |||||
| color | constant Optional. Line color(default black) | |||||
| width | number Optional. Width of line in the current metrics | |||||
| update_cur_pos | constant Optional. Determines where current position pointer will be placedConstantMeaning | |||||
| DFGR_SETPOS | Move current position to end of line | |||||
| DFGR_NOPOS | Leave current position unchanged |
DFWriteLine, which is not the same as DFWriteLn, is used to output a line (rule) to a page.
Many of the arguments can be named constants. DFGR_HORI (the default) provides for a horizontal line DFGR_VERT provides for a vertical line. DFGR_RB_MARGIN refers to the full distance the top and bottom margins or the left and right margins, as appropriate. DFGR_CURRLINE refers to the current line position
DFWriteLine 2 4 6 DFGR_HORI RGB_RED 0.1 DFGR_NOPOS
DFWriteLine DFGR_CURRLINE 3 DFGR_RB_MARGIN DFGR_VERT
DFWriteLn
Purpose DFWriteLn writes data to the current output line and begins a new output line. Syntax DFWriteLn {variable} [{attributes} [{decimal-places}]]
| Argument | Type | Explanation |
|---|---|---|
| variable | A literal, variable, or database field whose value is to be output | |
| attributes | Font attributes and colors | |
| decimal_places | Optional. Number of digits to the right of the decimal for numeric values |
If you use decimal_places, you must use all three arguments. If you use this argument, the output will be displayed with the number of decimal digits specified, right-justified to the page/header.
If you use FONT_LEFT, FONT_CENTER or FONT_RIGHT in attributes, the output will be justified to the page/header.
DFWriteln "End of report" (FONT_ITALIC +FONT_BOLD +RGB_RED)
DFWriteln visitors.id (FONT_DEFAULT)
DFWriteln 12345.67 (FONT_ITALIC +RGB_BLUE) 2
DFWriteLnPos
Purpose DFWriteLnPos appends data to the current line at a specified position from the left margin and begins a new output line. Syntax DFWriteLnPos {variable} {position} [{attributes} [{decimal_places} [{MaxLength}]]]
| Argument | Type | Explanation |
|---|---|---|
| variable | string A literal, variable, or database field whose value is to be output | |
| position | number Position to write at in the current metrics | |
| attributes | constant Optional. Font attributes and colors | |
| decimal_places | integer Optional. Number of digits to the right of the decimal for numeric values. Pass -1 for no-decimal places (i.e., a string output). | |
| MaxLength | number Optional. Determines maximum length of output value using the current system metrics (Inch or Cm) |
DFWriteLnPos appends data to the current line at a specified position from the left margin using the current metrics, specified by the value of dfCurrent_metrics in the WinPrint Global Object, and opens the next new line at the left margin.
If you use decimal_places, you must use all preceding arguments. If you use this argument, the output will be displayed with the number of decimal digits specified, right-justified to the position. When using decimals, set the position for the right side of the data.
MaxLength is an optional parameter and if not passed the entire output value will be output. Passing a length of zero (0) will also output the entire string. If you wish to pass the MaxLength parameter you must also pass parameters for Attributes and Decimal_places. Pass -1 for no-decimal places (i.e., a string output). The following commands are the same:
DFWriteLnPos Customer.Name 10
DFWriteLnPos Customer.Name 10 FONT.DEFAULT
DFWriteLnPos Customer.Name 10 FONT.DEFAULT -1
DFWriteLnPos Customer.Name 10 FONT.DEFAULT -1 0
If you use FONT_LEFT, FONT_CENTER or FONT_RIGHT in attributes, the text will be justified to the position.
DFWriteLnPos "Felons at Large" 0.5 (FONT_ITALIC +FONT_BOLD +RGB_RED) -1 10
DFWriteLnPos ammo.caliber 5 (FONT_DEFAULT) -1 5
DFWriteLnPos 12345.67 12.5 (FONT_ITALIC +RGB_BLUE) 2 4
DFWritePos
Purpose DFWritePos appends data to the current line at a specified position from the left margin. Syntax DFWritePos {variable} {position} [{attributes} [{decimal_places} [{MaxLength}]]]
| Argument | Type | Explanation |
|---|---|---|
| variable | string A literal, variable, or database field whose value is to be output | |
| position | number Position to write at in the current metrics | |
| attributes | constant Optional. Font attributes and colors | |
| decimal_places | integer Optional. Number of digits to the right of the decimal for numeric values. Pass -1 for no-decimal places (i.e., a string output). | |
| MaxLength | number Optional. Determines maximum length of output value using the current system metrics (Inch or Cm) |
DFWritePos appends data to the current line at a specified position from the left margin using the current metrics, specified by the value of dfCurrent_metrics in theWinPrint Global Object.
If you use decimal_places, you must use all preceding arguments. If you use this argument, the output will be displayed with the number of decimal digits specified, right-justified to the position. When using decimals, set the position for the right side of the data.
MaxLength is an optional parameter and if not passed the entire output value will be output. Passing a length of zero (0) will also output the entire string. If you wish to pass the MaxLength parameter you must also pass parameters for Attributes and Decimal_places. Pass -1 for no-decimal places (i.e., a string output). The following commands are the same:
DFWritePos Customer.Name 10
DFWritePos Customer.Name 10 FONT.DEFAULT
DFWritePos Customer.Name 10 FONT.DEFAULT -1
DFWritePos Customer.Name 10 FONT.DEFAULT -1 0
If you use FONT_LEFT, FONT_CENTER or FONT_RIGHT in attributes, the text will be justified to the position.
DFWritePos "Prior Convictions" 0.5 (FONT_ITALIC +FONT_BOLD +RGB_RED) -1 10
DFWritePos sentence.length 5 (FONT_DEFAULT) -1 5
DFWritePos 12345.67 12.5 (FONT_ITALIC +RGB_BLUE) 2 4
DFWriteRect
Purpose DFWriteRect is used to write a rectangle to the page. DFWriteRect is very useful to place borders around section headers and/or footers. Syntax DFWriteRect {vert} {horz} {height} {width} [{line_color} [{line_width} [{reprint} [{fill_color} [{update_cur_pos}]]]]]
| Argument | Type | Explanation | Constant | Meaning | Constant | Meaning |
|---|---|---|---|---|---|---|
| vert | number Location (upper-left corner) vertical coordinate. DFGR_CURRLINE= current line position | |||||
| horz | number Location (upper-left corner) horizontal coordinate. DFGR_CURRLINE= current line position | |||||
| height | number Height of rectangle in the current metrics. DFGR_RB_MARGIN = height of entire header | |||||
| width | number Width of rectangle in the current metrics. DFGR_RB_MARGIN = width of header / width of page | |||||
| line_color | constant Optional. Color of rectangle border lines (default black) | |||||
| line_width | number Optional. Width of rectangle border lines in the current metrics | |||||
| reprint | constant Optional. determines if graphic is reprinted on each page.ConstantMeaning | |||||
| DFGR_NOWRAP | Print once only | |||||
| DFGR_WRAP | Print on each succeeding page | |||||
| fill_color | constant Optional. Fill Color (default transparent) | |||||
| update_cur_pos | constant Optional. Determines where current position pointer will be placedConstantMeaning | |||||
| DFGR_SETPOS | Move current position to end of rectangle | |||||
| DFGR_NOPOS | Leave current position unchanged |
DFGR_RB_MARGIN refers to the full distance between the top and bottom margins or left and right margins, as appropriate. DFGR_CURRLINE refers to the current line position.
DFWriteRect 2 4 6 4 RGB_BLACK 0.1 DFGR_NOWRAP ;
RGB_RED DFGR_NOPOS
DFWriteRect 0 0 DFGR_RB_MARGIN DFGR_RB_MARGIN RGB_BLACK 0.3
DFWriteXYLine
Purpose DFWriteXYLine is used to place a line (rule) on the page from one point to another. Syntax DFWriteXYLine {vert} {horz} {vert_stop} {horz_stop} [{color} [{width} [{reprint} [{update_cur_pos}]]]]
| Argument | Type | Explanation | Constant | Meaning | Constant | Meaning |
|---|---|---|---|---|---|---|
| vert | number Start location vertical coordinate in the current metrics. DFGR_CURRLINE= current line position. | |||||
| horz | number Start location horizontal coordinate in the current metrics. DFGR_CURRLINE= current line position. | |||||
| vert_stop | number Stop location vertical coordinate in the current metrics.DFGR_RB_MARGIN = height of entire header. | |||||
| horz_stop | number Stop location horizontal coordinate in the current metrics. DFGR_RB_MARGIN = width of header / width of page. | |||||
| color | constant Optional. Line Color (default black) | |||||
| width | number Optional. Width of line in the current metrics | |||||
| reprint | constant Optional. Determines how line is drawn on pagesConstantMeaning | |||||
| DFGR_NOWRAP | Print once only | |||||
| DFGR_WRAP | Print on each succeeding page | |||||
| update_cur_pos | constant Optional. Determine how current line is affectedConstantMeaning | |||||
| DFGR_SETPOS | Move current position to end of line | |||||
| DFGR_NOPOS | Leave current position unchanged |
The line need not be either horizontal or vertical. You cannot use DFGR_CURRLINE with DFWriteXYLine. DFGR_RB_MARGIN refers to the full distance between the top and bottom margins or the left and right margins, as appropriate. DFGR_CURRLINE refers to the current line position.
DFWriteXYLine 0 0 DFGR_RB_MARGIN DFGR_RB_MARGIN RGB_BLACK 0.1 DFGR_WRAP ;
DFGR_NOPOS
DFWriteXYLine 1 1 10 15 RGB_BLACK
Report_Breaks
This command defines the breakpoints needed in a report.
Object oReport is a cWinReport2
Report_Breaks OrderHea.Customer_Number
:
Object oReport is a cWinReport2
Report_Breaks Customer.Region Customer.SubRegion
:
The breakpoints can be just about anything. They can be a file.field , they can be a variable, or they can be a built-in or a user-defined function.
Object oReport is a cWinReport2
Report_Breaks (SomeBreakFunction(self))
Report_Breaks (Left(Vndr.Name, 1)) Vndr.Name
Report_Breaks (G_Func(Desktop, Vndr.Id))
Report_Breaks (L_Func(Self, Vndr.Due))
The report_breaks command actually creates a custom function named test_breakpoints. Therefore, when used in a class, the report_breaks command must not be placed in a procedure or function, but should be placed directly inside the class. The following example shows how a cWinReport2 subclass should be created using the various report_???? commands.
Class cVReport is a cWinReport2
Report_Breaks (left(Vndr.name, 1)) Vndr.Name
Procedure Construct_Object integer iMyImage
Forward Send Construct_Object iMyImage
Report_Main_File Vndr
Report_Index by Vndr.Name
End_Procedure
:
End_Class
Report_Data_Set
Report_Data_Set is an obsolete command. You should always use the Set Server property to define the main file in a report.
Object oVndrReport is a cWinReport2
Set Server to oVndr_DD
Set Ordering to 2
Report_Breaks Vendor.State
:
Report_Index
Report_Index is an obsolete command. You should always use set Ordering to set the ordering of a report.
Object oVndrReport is a cWinReport2
Set Server to oVndr_DD
Set Ordering to 2
Report_Breaks Vendor.State
:
Report_Main_File
Report_Main_File is an obsolete command. You should always use set Main_File to set the main file of a report.
Object oVndrReport is a cWinReport2
Set Server to oVndr_DD
Set Main_File to Vndr.File_Number
Report_Breaks Vendor.State
: