/////////////////////////////////////////////////////////////////////
// TPRINT CLASS
/////////////////////////////////////////////////////////////////////
This class is a wrapper for different modes of printing a report or
exporting it to a file.
How to use it:
The general procedure to use this class is:
1. Instantiate an object.
2. Initialize object variables and allocate resources.
3. Select a printer (if you want to print the document.)
4. Signal the start of the document.
5. Repeat for each page:
Signal the start of the page.
Print data, barcodes, images, lines and rectangles.
Signal the end of the page.
6. Signal the end of the document.
7. Release allocated resources.
Notes:
All this steps are required to obtain the intended output
and avoid errors and memory leaks.
See .\samples\oohg\printtest.prg for a functional sample.
Use "compile MainDemoOop" to build and test it.
How to instantiate an object:
oTPrintObject := TPRINT( cMode )
Returns an object that allows you to build a document and to print
or export it to a file.
Valid values for cMode are:
HBPRINTER = Prints using HBPrinter library.
MINIPRINT = Prints using Miniprint library.
DOSPRINT = Prints directly to printer (DOS printing).
CALCPRINT = Generates an OpenOffice Calc file
(OpenOffice must be installed installed).
EXCELPRINT = Generates an Excel file
(Excel must be installed).
RTFPRINT = Generates an RTF file.
HTMLPRINT = Generates an HTML file using Excel if installed
or Calc if it's not.
HTMLPRINTFROMCALC = Generates an HTML file using Calc.
HTMLPRINTFROMEXCEL = Generates an HTML file using Excel.
PDFPRINT = Generates a PDF file.
CSVPRINT = Generates a comma-separated values file (CSV).
RAWPRINT = Prints directly to a spool queue (in binary).
SPREADSHEETPRINT = Generates an Excel file using BIFF format
(neither Excel nor OpenOffice are need).
Notes:
If cMode is omitted, the selected library depends on public variable
_OOHG_PrintLibrary.
If the variable is not a string, MINIPRINT will be selected.
If its a string but its value is not one of the expected values,
HBPRINTER will be selected.
If cMode is present but is not one of the expected string values,
MINIPRINT will be selected.
Once the TRINT object is created, _OOHG_PrintLibrary is set to the
selected mode.
Main methods:
::Init()
Initializes object variables and allocates resources.
Notes:
This method sets the DATA lPrError .T. if another document is
being printed.
::SelPrinter( lSelect, lPreview, lLandscape, nPaperSize, cPrinter, ;
lHide, nRes, nBin, nDuplex, lCollate, nCopies, lColor, ;
nScale, nPaperLength, nPaperWidth )
For HBPRINTER, MINIPRINT, DOSPRINT and RAWPRINT modes, selects
and initializes the printer. For RTFPRINT, sets the page orientation.
For TPDFPRINT, sets the page size and orientation. Does nothing for
other modes.
Parameters:
lSelect = .T. to select the printer from a dialog (default),
.F. to print in the system's default printer
It's ignored if cPrinter is not NIL.
lPreview = .T. to show a preview before printing (default),
.F. to print directly.
lLandscape = .T. to print in landscape orientation,
.F. to print in portrait orientation (default).
nPaperSize = sets the paper size (defaults to printer's value).
See "miniprint.ch" and "winprint.ch" for valid values.
Check "wingdi.h" to see if a given paper size is
supported by a given Windows version.
cPrinter = name of an existing printer to use for printing
(if omitted and lSelect is .T. a selection dialog will
pop up, if it's .F. the default printer will be used).
lHide = .F. to show a "wait" window while printing (default),
.T. to show none.
nRes = resolution (defaults to printer's value).
See "miniprint.ch" and "winprint.ch" for valid values.
nBin = tray number from which the paper will be taken
(defaults to printer's value).
See "miniprint.ch" and "winprint.ch" for valid values.
nDuplex = duplex type (defaults to printer's value).
See "miniprint.ch" and "winprint.ch" for valid values.
lCollate = .T. to enable collate printing if printer supports it,
.F. to disable (defaults to printer's value).
nCopies = number of copies that the printer will print if it
supports automatic multiple copies printing (defaults
to printer's value).
lColor = for color printers, sets monochrome or color mode
(defaults to printer's value).
nScale = Specifies the factor by which the printed output is to
be scaled (defaults to printer's value).
nPaperLength = Overrides the length of the paper specified by the
nPaperSize parameter (defaults to printer's value).
Unit: 1/10 mm.
nPaperWidth = Overrides the width of the paper specified by the
nPaperSize parameter (defaults to printer's value).
Unit: 1/10 mm.
Parameter support by printing mode:
MINIPRINT and HBPRINTER:
All.
DOSPRINT:
Only lSelect, lPreview, cPrinter and lHide are suppported.
RAWPRINT:
Only lSelect, cPrinter and lHide are suppported.
RTFPRINT:
Only lPreview, lLandscape and lHide are supported.
PDFPRINT:
Only lPreview, lLandscape, nPaperSize and lHide are supported.
EXCELPRINT, SPREADSHEETPRINT, HTMLPRINT, HTMLPRINTFROMEXCEL,
HTMLPRINTFROMCALC, CSVPRINT and CALCPRINT:
Only lPreview and lHide are supported.
::BeginDoc( cName )
Signals the start of a document.
Parameters:
cName = name of the print document (defaults to "list").
If the library generates a file, any provided extension
will be stripped and a default extension will be added.
Provide a path to save in a specific folder (defaults
to My Documents).
Notes:
Default extensions are:
"dos" for DOSPRINT.
"raw" for RAWPRINT.
"rtf" for RTFPRINT.
"pdf" for PDFPRINT.
"xls" for EXCELPRINT using Excel version previous to 2007.
"xlsx" for EXCELPRINT using Excel version 2007 or later.
"xls" for SPREADSHEETPRINT.
"html" for HTMLPRINT, HTMLPRINTFROMEXCEL and HTMLPRINTFROMCALC.
"csv" for CSVPRINT.
"odt" for CALCPRINT.
::BeginPage( cName )
Signals the start of a page inside a document.
Parameters:
cName = name of the page. Must be unique.
Defaults to "Page_" + page_number.
For EXCELPRINT and CALCPRINT: the page name is used as
caption for the sheet.
::EndPage()
Signals the end of a page inside a document.
::EndDoc( lSaveTemp )
Signals the end of a document.
Parameters:
lSaveTemp = .T. to save temporary files, .F. to discard.
Notes:
For HBPRINTER, MINIPRINT, DOSPRINT and RAWPRINT modes: if lPreview
parameter of method SelPrinter was .T., a preview screen with the
document's content is shown.
For EXCELPRINT, CALCPRINT, SPREADSHEETPRINT, HTMLPRINT, HTMLPRINTCALC,
HTMLPRINTEXCEL, RTFPRINT, CSVPRINT and PDFPRINT modes: opens the
document using the systems' default application.
Parameter support by printing mode:
lSaveTemp is only supported by DOSPRINT and RAWPRINT modes.
::Release()
Releases the TPRINT object and all allocated resources.
Data print methods:
::PrintData( nLin, nCol, uData, cFont, nSize, lBold, aColor, ;
cAlign, nLen, lItalic, nAngle, lUnder, lStrike, nWidth )
Prints data in a page.
Parameters:
nLin = y coordinate of starting point (ROWCOL or MM).
Defaults to 1.
nCol = x coordinate of starting point (ROWCOL or MM).
Defaults to 1.
uData = data to print (see note), defaults to "".
cFont = name of the default font for printing. Defaults to value
of DATA cFontName. See MSDN for CreateFont function to
learn more about fonts.
nSize = size of the font in points. Defaults to value of DATA
nFontSize.
lBold = .T. for printing with bold weight, .F. for printing with
normal weight. Defauls to value of DATA lFontBold.
aColor = text color of printed data ({nRed, nGreen, nBlue}).
Defaults to value of DATA aFontColor.
cAlign = text alignment:
L - left (default)
C - center
R - right
nLen = width (in chars) of the field where the data will be
printed, this value is used to right or center align
the data in a part of the line. Defaults to 15.
lItalic = .T. for printing with italic style, .F. for printing
without. Defauls to value of DATA lFontItalic.
nAngle = the rotation of a character. Unit: 1/10 degree.
Defaults to 0.
lUnder = .T. for printing with underlined style, .F. for printing
without. Defauls to value of DATA lFontUnderline.
lStrike = .T. for printing with strikedoud style, .F. for printing
without. Defauls to value of DATA lFontStrikeout.
nWidth = the average width of characters. Unit: logical units.
Defaults to system's default value.
Notes:
Codeblocks are evaluated and the resulting values are treated
according the following rules.
Strings and memos are printed as they are.
Numbers are converted to strings using AllTrim( Str( uData ) ).
Dates are converted to strings usings DtoC( uData ).
Logicals are converted to "T" or "F".
Timestaps are converted to strings using TtoC( uData ).
Objects are printed as "< Object >".
Arrays are printed as "< Array >".
Other data type values are printed as empty strings.
Parameter support by printing mode:
MINIPRINT:
All.
THBPRINTER:
All.
DOSPRINT:
Only nLin, nCol, uData, lBold, cAlign and nLen.
RAWPRINT:
Only nLin, nCol, uData, lBold, cAlign and nLen.
EXCELPRINT:
nWidth is not supported.
SPREADSHEETPRINT:
Only nLin, nCol, uData, cAlign and nLen.
RTFPRINT:
cFont, aColor, nAngle and nWidth are not supported.
This mode uses "Times New Roman" as default font when
printing in MM and "Courier New" when printing in ROWCOL.
You can embed whatever format you want in uData, as long as it's
written using proper RTF syntax. Notice that the content of a
RichEditBox control can be printed this way.
CSVPRINT:
Only nLin, nCol, uData, cAlign and nLen.
PDFPRINT:
nAngle, lUnder, lStrike and nWidth are not supported.
cFont accepts "Helvetica", "Times" and "Courier". Other fonts are
mapped to them: roman types to "Times", "Ariel" to "Helvetica" and
the remaining ones to "Courier".
CALCPRINT:
nWidth is not supported.
HTMLPRINT:
nWidth is not supported.
HTMLPRINTFROMCALC:
nWidth is not supported.
HTMLPRINTFROMEXCEL:
nWidth is not supported.
::PrintImage( nSRow, nSCol, nERow, nECol, cImage, aResol, aSize )
Prints an image.
Parameters:
nSRow = y coordinate of the upper left corner.
Defaults to 1.
nSCol = x coordinate of the upper left corner.
Defaults to 1.
nERow = y coordinate of the lower right corner.
Defaults to 4.
nECol = x coordinate of the lower right corner.
Defaults to 4.
cImage = name of the image to print. Must point to a file.
MINIPRINT and HBPRINTER also accept images from the resource
file. See note. Defaults to "<>".
aResol = array specifing horizontal and vertical resolution of the
image (or a number if both values are the same). Unit: DPI.
aSize = array specifing width and height of the image (or a number
if both values are the same). Unit: 1/100 mm.
Notes:
MINIPRINT and HBPRINTER support ICO, BMP, JPG and GIF formats.
EXCELPRINT and HTMLPRINTFROMEXCEL support formats supported by Excel.
CALCPRINT and HTMLPRINTFROMCALC support formats supported by Calc.
PDFPRINT supports JPG and GIF formats. Beware that cImage must point
to a file with TIF, TIFF, JPG or JPEG extension.
DOSPRINT, RAWPRINT, SPREADSHEETPRINT, RTFPRINT and CSVPRINT do not
support image printing.
When using HTMLPRINT, supported formats depend on the underlying app
installed on the system (if both Excel and Calc are installed, the
first takes precedence; you can test DATA cPrintLibrary to identify
which one is being used).
Parameter support by printing mode:
aResol and aSize are supported by CALCPRINT mode only.
Specify aResol to print the image at its original size. To find the
image resolution use a graphics software like IrfanView.
Specify aSize to print the image at a different size.
If both parameters are specified, resolution takes precedence.
If none is specified the resulting size is defined by Calc.
::PrintLine( nSRow, nSCol, nERow, nECol, aColor, nWidth, lSolid )
Prints a line from one point to another.
Parameters:
nSRow = y coordinate of the starting point.
Defaults to 1.
nSCol = x coordinate of the starting point.
Defaults to 1.
nERow = y coordinate of the ending point.
Defaults to 4.
nECol = x coordinate of the ending point.
Defaults to 4.
aColor = line's color ({nRed, nGreen, nBlue}).
Defaults to value of DATA aColor.
nWidth = line's width (see note).
Defaults to value of DATA nwPen.
lSolid = .F. for dashed line, .T. for continuous (default).
Notes:
DOSPRINT, RAWPRINT and RTFPRINT modes only support the printing of
horizontal lines (nSRow == nERow). Lines are printed using dashes.
PDFPRINT mode only supports the printing of horizontal (nSRow == nERow)
or vertical (nSCol == nECol) lines.
MINIPRINT and HBPRINTER can print horizontal, vertical and oblique lines.
Other modes don't support line printing.
nWidth units: mm for MINIPRINT and HBPRINTER, 1/72 inches for PDFPRINT.
If nWidth is greater than 1, lSolid is ignored and assumed .T.
Parameter support by printing mode:
MINIPRINT and HBPRINTER:
All.
PDFPRINT:
lSolid not suported (assumed .T.).
DOSPRINT and RAWPRINT:
aColor, nWidth and lSolid not supported.
RTFPRINT:
nWidth and lSolid not supported.
::PrintRectangle( nSRow, nSCol, nERow, nECol, aColorOut, nWidth, lSolid, aColorFil )
Prints a rectangle defined by 4 lines between points:
{nSRow, nSCol} to {nSRow, nECol},
{nSRow, nECol} to {nERow, nECol},
{nERow, nECol} to {nERow, nSCol} and
{nERow, nSCol} to {nSRow, nSCol}.
Parameters:
nSRow = y coordinate of the upper left corner.
Defaults to 1.
nSCol = x coordinate of the upper left corner.
Defaults to 1.
nERow = y coordinate of the lower right corner.
Defaults to 4.
nECol = x coordinate of the lower right corner.
Defaults to 4.
aColorOut = outline color ({nRed, nGreen, nBlue}).
Defaults to value of DATA aColor.
nWidth = border's width (see note).
Defaults to value of DATA nwPen.
lSolid = .F. for dashed line, .T. for continuous (default).
aColorFil = filling color ({nRed, nGreen, nBlue}).
Defaults to WHITE.
Notes:
Only PDFPRINT, MINIPRINT and HBPRINTER support rectangle printing.
nWidth units: mm for MINIPRINT and HBPRINTER, 1/72 inches for PDFPRINT.
If nWidth is greater than 1, lSolid is ignored and assumed .T.
Parameter support by printing mode:
MINIPRINT and HBPRINTER:
All.
PDFPRINT:
lSolid not suported (assumed .T.).
::PrintRoundRectangle( nSRow, nSCol, nERow, nECol, aColorOut, nWidth, lSolid, aColorFil )
Prints a rectangle with rounded corners, defined by 4 lines between
points:
{nSRow, nSCol} to {nSRow, nECol},
{nSRow, nECol} to {nERow, nECol},
{nERow, nECol} to {nERow, nSCol} and
{nERow, nSCol} to {nSRow, nSCol}.
Parameters:
nSRow = y coordinate of the upper left corner.
Defaults to 1.
nSCol = x coordinate of the upper left corner.
Defaults to 1.
nERow = y coordinate of the lower right corner.
Defaults to 4.
nECol = x coordinate of the lower right corner.
Defaults to 4.
aColorOut = outline color ({nRed, nGreen, nBlue}).
Defaults to value of DATA aColor.
nWidth = border's width (see note).
Defaults to value of DATA nwPen.
lSolid = .F. for dashed line, .T. for continuous (default).
aColorFil = filling color ({nRed, nGreen, nBlue}).
Defaults to WHITE.
Notes:
Only MINIPRINT and HBPRINTER support round rectangle printing.
PDFPRINT prints them with squared corners.
nWidth units: mm for MINIPRINT and HBPRINTER, 1/72 inches for PDFPRINT.
If nWidth is greater than 1, lSolid is ignored and assumed .T.
Parameter support by printing mode:
MINIPRINT and HBPRINTER:
All.
PDFPRINT:
lSolid not suported (assumed .T.).
::PrintBarCode( nRow, nCol, cCode, cType, aColor, lHorizontal, nWidth, nHeight )
Generates and prints a barcode of a certain type.
Parameters:
nRow = y coordinate of the starting point.
Defaults to 1.
nCol = x coordinate of the starting point.
Defaults to 1.
cCode = value to be converted into a barcode.
Defaults to "<>".
cType = encoding type of the barcode. Supported types are
CODE128A, CODE128B, CODE128C, CODE39, EAN8, EAN13,
INTER25, UPCA, SUP5, CODABAR, IND25 and MAT25.
Defaults to CODE128C.
aColor = bars' color ({nRed, nGreen, nBlue}).
Defaults to value of DATA aBarColor.
lHorizontal = .F. for vertical printing, .T. for horizontal (default).
nWidth = width of each bar. Unit: mm.
Defaults to NIL.
nHeight = height of each bar. Unit: mm.
Defaults to 10.
Notes:
This method is a wrapper for methods ::Code128, ::Code3_9, ::Codabar,
::Ean8, ::Ean13, ::Ind25, ::Int25, ::Mat25, ::Sup5 and ::Upca.
::Code128( nRow, nCol, cCode, cVariant, aColor, lHorizontal, nWidth, nHeigth )
Generates and prints a CODE128A, CODE128B or CODE128C encoded barcode.
Parameters:
nRow = y coordinate of the starting point.
Defaults to 1.
nCol = x coordinate of the starting point.
Defaults to 1.
cCode = value to be converted into a barcode.
cVariant = code variant to print. Supported types are "A", "B", "C"
or "" (variable mode: cCode is analized to identify type).
aColor = bars' color ({nRed, nGreen, nBlue}).
lHorizontal = .F. for vertical printing, .T. for horizontal.
nWidth = width of each bar. Unit: mm.
nHeight = height of each bar. Unit: mm.
Notes:
This method relies on function _Code128() to generate the barcode
and on method ::Go_Code to print it.
::Code3_9( nRow, nCol, cCode, aColor, lHorizontal, nWidth, nHeigth )
Generates and prints a CODE39 encoded barcode.
Parameters:
nRow = y coordinate of the starting point.
Defaults to 1.
nCol = x coordinate of the starting point.
Defaults to 1.
cCode = value to be converted into a barcode.
aColor = bars' color ({nRed, nGreen, nBlue}).
lHorizontal = .F. for vertical printing, .T. for horizontal.
nWidth = width of each bar. Unit: mm.
nHeight = height of each bar. Unit: mm.
Notes:
This method relies on function _Code3_9() to generate the barcode
and on method ::Go_Code to print it.
::Codabar( nRow, nCol, cCode, aColor, lHorizontal, nWidth, nHeigth )
Generates and prints a CODABAR encoded barcode.
Parameters:
nRow = y coordinate of the starting point.
Defaults to 1.
nCol = x coordinate of the starting point.
Defaults to 1.
cCode = value to be converted into a barcode.
aColor = bars' color ({nRed, nGreen, nBlue}).
lHorizontal = .F. for vertical printing, .T. for horizontal.
nWidth = width of each bar. Unit: mm.
nHeight = height of each bar. Unit: mm.
Notes:
This method relies on function _Codabar() to generate the barcode
and on method ::Go_Code to print it.
::Ean8( nRow, nCol, cCode, aColor, lHorizontal, nWidth, nHeigth )
Generates and prints an EAN-8 encoded barcode.
Parameters:
nRow = y coordinate of the starting point.
Defaults to 1.
nCol = x coordinate of the starting point.
Defaults to 1.
cCode = value to be converted into a barcode.
aColor = bars' color ({nRed, nGreen, nBlue}).
lHorizontal = .F. for vertical printing, .T. for horizontal.
nWidth = width of each bar. Unit: mm. Defaults to 1.5
nHeight = height of each bar. Unit: mm.
Notes:
This method relies on functions _Upc() and _Ean13bl() to generate
the barcode and on method ::Go_Code to print it.
::Ean13( nRow, nCol, cCode, aColor, lHorizontal, nWidth, nHeigth )
Generates and prints an EAN-13 encoded barcode.
Parameters:
nRow = y coordinate of the starting point.
Defaults to 1.
nCol = x coordinate of the starting point.
Defaults to 1.
cCode = value to be converted into a barcode.
aColor = bars' color ({nRed, nGreen, nBlue}).
lHorizontal = .F. for vertical printing, .T. for horizontal.
nWidth = width of each bar. Unit: mm. Defaults to 1.5
nHeight = height of each bar. Unit: mm.
Notes:
This method relies on functions _Ean13() and _Ean13bl() to generate
the barcode and on method ::Go_Code to print it.
::Ind25( nRow, nCol, cCode, aColor, lHorizontal, nWidth, nHeigth )
Generates and prints a CODE 25 INDUSTRIAL encoded barcode.
Parameters:
nRow = y coordinate of the starting point.
Defaults to 1.
nCol = x coordinate of the starting point.
Defaults to 1.
cCode = value to be converted into a barcode.
aColor = bars' color ({nRed, nGreen, nBlue}).
lHorizontal = .F. for vertical printing, .T. for horizontal.
nWidth = width of each bar. Unit: mm.
nHeight = height of each bar. Unit: mm.
Notes:
This method relies on functions _Ind25() to generate the barcode
and on method ::Go_Code to print it.
::Int25( nRow, nCol, cCode, aColor, lHorizontal, nWidth, nHeigth )
Generates and prints a CODE 25 INTERLEAVED encoded barcode.
Parameters:
nRow = y coordinate of the starting point.
Defaults to 1.
nCol = x coordinate of the starting point.
Defaults to 1.
cCode = value to be converted into a barcode.
aColor = bars' color ({nRed, nGreen, nBlue}).
lHorizontal = .F. for vertical printing, .T. for horizontal.
nWidth = width of each bar. Unit: mm.
nHeight = height of each bar. Unit: mm.
Notes:
This method relies on functions _Int25() to generate the barcode
and on method ::Go_Code to print it.
::Upca( nRow, nCol, cCode, aColor, lHorizontal, nWidth, nHeigth )
Generates and prints an UPC-A encoded barcode.
Parameters:
nRow = y coordinate of the starting point.
Defaults to 1.
nCol = x coordinate of the starting point.
Defaults to 1.
cCode = value to be converted into a barcode.
aColor = bars' color ({nRed, nGreen, nBlue}).
lHorizontal = .F. for vertical printing, .T. for horizontal.
nWidth = width of each bar. Unit: mm. Defaults to 1.5
nHeight = height of each bar. Unit: mm.
Notes:
This method relies on functions _Upc() and _Upcabl() to generate
the barcode and on method ::Go_Code to print it.
::Mat25( nRow, nCol, cCode, aColor, lHorizontal, nWidth, nHeigth )
Generates and prints a MATRIX 2 OF 5 encoded barcode.
Parameters:
nRow = y coordinate of the starting point.
Defaults to 1.
nCol = x coordinate of the starting point.
Defaults to 1.
cCode = value to be converted into a barcode.
aColor = bars' color ({nRed, nGreen, nBlue}).
lHorizontal = .F. for vertical printing, .T. for horizontal.
nWidth = width of each bar. Unit: mm.
nHeight = height of each bar. Unit: mm.
Notes:
This method relies on functions _Mat25() to generate the barcode
and on method ::Go_Code to print it.
::Sup5( nRow, nCol, cCode, aColor, lHorizontal, nWidth, nHeigth )
Generates and prints an EAN-5 encoded barcode.
Parameters:
nRow = y coordinate of the starting point.
Defaults to 1.
nCol = x coordinate of the starting point.
Defaults to 1.
cCode = value to be converted into a barcode.
aColor = bars' color ({nRed, nGreen, nBlue}).
lHorizontal = .F. for vertical printing, .T. for horizontal.
nWidth = width of each bar. Unit: mm.
nHeight = height of each bar. Unit: mm.
Notes:
This method relies on functions _Sup5() to generate the barcode
and on method ::Go_Code to print it.
::Go_Code( cBarcode, nRow, nCol, lHorizontal, aColor, nWidth, nHeigth )
Prints a barcode.
Parameters:
cBarCode = barcode to print.
nRow = y coordinate of the starting point.
Defaults to 0.
nCol = x coordinate of the starting point.
Defaults to 0.
aColor = bars' color ({nRed, nGreen, nBlue}).
Defaults to BLACK.
lHorizontal = .F. for vertical printing, .T. for horizontal (default).
nWidth = width of each bar. Unit: mm. Defaults to 0.495.
nHeight = height of each bar. Unit: mm. Defaults to 15.
Other methods:
::CondenDos()
Sets the printer to condensed mode.
Notes:
Applies only to DOSPRINT mode.
::GetDefPrinter()
Gets the name of the default printer.
Notes:
Applies only to MINIPRINT and HBPRINTER modes.
::MaxCol()
Returns the maximum number of printable columns.
Notes:
Applies only to TMINIPRINT, THBPRINTER, TEXCELPRINT and TCALCPRINT modes.
For other modes it returns 0.
::MaxRow()
Returns the maximum number of printable rows.
Notes:
Applies only to TMINIPRINT, THBPRINTER, TEXCELPRINT and TCALCPRINT modes.
For other modes it returns 0.
::NormalDos()
Sets the printer to normal mode.
Notes:
Applies only to DOSPRINT mode.
::PrintMode()
Prints the content of the file pointed by DATA cTempFile.
Notes:
Applies only to DOSPRINT and RAWPRINT modes.
For DOSPRINT is equivalent to ::PrintDos( ::cTempFile ).
For RAWPRINT is equivalent to ::PrintRaw( ::cTempFile ).
::PrintDos( cFile )
Prints the content of a file, by copying it to the printer port
specified by DATA cPort, using DOS Copy command.
Parameters:
cFile = name of the file to print.
::PrintRaw( cFile )
Prints the content of the file pointed by DATA TempFile, by
copying it to the printer specified by DATA cPrinter, using
Windows WritePrinter function.
::SetBarColor( aColor )
Sets the default color for barcodes.
Parameters:
aColor = color ({nRed, nGreen, nBlue}).
Defaults to almost BLACK ({1, 1, 1}).
Notes:
This method sets the DATA aBarColor.
::SetColor( aColor )
Sets the default color for text, lines and rectangles.
Parameters:
aColor = color ({nRed, nGreen, nBlue}).
Defaults to BLACK.
Notes:
This method sets the DATA aColor.
::SetCPL( nCpl )
Sets the maximum number of printed characters per line.
Parameters:
nCpl = 60, 80, 96, 120, 140 or 160. Defaults to 80 for all modes
except for RTFPRINT which defaults to 96.
Notes:
The desired number of CPL is achieved by the setting of the default
size of the font (DATA nFontSize) to 14, 12, 10, 8, 7 and 6 points
respectively.
::SetDosPort( cPort )
Sets the DOS port to use for printing.
Parameters:
cPort = PRN, LPT1: to LPT6: and system's local ports.
Notes:
Applies only to DOSPRINT mode.
::SetFont( cFont, nSize, aColor, lBold, lItalic, nAngle, lUnder, lStrike, nWidth )
Sets the attributes of the default font.
Parameters:
cFont = name of a font installed in the system.
Defaults to value of DATA cFontName.
nSize = size in points.
Defaults to value of DATA nFontSize.
aColor = color ({nRed, nGreen, nBlue}).
Defaults to value of DATA aFontColor.
lBold = .T. for bold type, .F. for non bold type.
Defaults to value of DATA lFontBold.
lItalic = .T. for italic type, .F. for non-italic type.
Defaults to value of DATA lFontItalic.
nAngle = the rotation of the characters. Unit: 1/10 degree.
Defaults to value of DATA nFontAngle.
lUnder = .T. for underline type, .F. for non underline type.
Defaults to value of DATA lFontUnderline.
lStrike = .T. for strikeout type, .F. for non strikeout type.
Defaults to value of DATA lFontStrikeout.
nWidth = average width of characters, in logical units.
Defaults to value of DATA nFontWidth.
Notes:
Search MSDN for CreateFont function to learn more about fonts.
::SetFontType( nFontType )
Sets the default weight of the letter for a page.
Parameters:
nFontType = 0 for normal weight, 1 for bold.
Notes:
Applies only to PDFPRINT mode.
::SetIndentation( lIndentation )
Sets the indentation mode when printing the RichValue of a RichEditBox.
Parameters:
lIndentation = when .T. and the RichValue contains more than one
line, all lines are placed at the column specified
in the PrintData call. When .F., subsequent lines
are placed at column 0.
Notes:
Applies only to TRTFPRINT mode.
::SetLMargin( nLMar )
Sets the left margin for printed lines.
Parameters:
nLMar = number of columns or millimiters. Defaults to 0.
::SetPreviewSize( nSize )
Sets the preview initial size (zoom) for HBPRINTER and MINIPRINT modes.
Parameters:
nSize = For HBPRINTER mode: 1 to 5 (small to big).
Defaults to 3.
For MINIPRINT mode: -9.99 to 99.99 (small to big).
Defaults to 0.
::SetProp( lMode )
Sets whether the row height will be proportional to the size of the
default font (DATA nFontSize) or to 10 points.
Parameters:
lMode = .T. for nFontSize, .F. for 10 points (default).
::SetRawPrinter( cPrinter )
Sets the printer queue to use when printing through the spooler.
Parameters:
cPrinter = name of a printer managed by the system's spool.
Notes:
Applies only to RAWPRINT mode.
::SetSeparateSheet( lSeparateSheets )
Sets the use of a different sheet for each page in the document.
Notes:
Applies only to EXCELPRINT and CALCPRINT.
::SetShowErrors( lShow )
Enables or disables the display of messages when an error occurs.
::SetTMargin( nTMar )
Sets the top margin for printed pages.
Parameters:
nTMar = number of rows or millimiters. Defaults to 0.
::SetUnits( cUnits, nUnitsLin )
Sets the units that will be used for printing.
Parameters:
cUnits = MM for milimiters or ROWCOL for rows and columns (default).
Notes:
The class uses internally MM to try to obtain documents that look
in the same way when printed on different printers.
::Version()
Gets the version number of the TPRINT library.
Datas:
All the datas are READONLY.
Initial value Notes
::aBarColor {1, 1, 1} brush color for barcodes
::aColor {0, 0, 0} brush color
::aFontColor {0, 0, 0} font color
::aLinCelda {}
::aPageNames {} page's names
::aPorts {} available printing ports
::aPrinters {} available printers
::Cargo "list" document's name without extension
::cDocument "" document's name with extension
::cFontName "Courier New" font name
::cPageName "" current page name
::cPort "PRN" currently selected port
::cPrinter "" currently selected printer
::cPrintLibrary "HBPRINTER" currently selected printer mode
::cTempFile TEMP_FILE_NAME
::cUnits "ROWCOL" currently selected printing units
::cVersion "(oohg-tprint)V 4.10" library's current version
::Exit .F.
::ImPreview .T.
::lFontBold .F.
::lFontItalic .F.
::lFontStrikeout .F.
::lFontUnderline .F.
::lIndentAll .F. Indent RicheEdit lines
::lLandscape .F. Page orientation
::lPrError .F.
::lProp .F.
::lSaveTemp .F.
::lSeparateSheets .T.
::lShowErrors .T.
::lWinHide .F.
::nFontAngle 0
::nFontSize 12
::nFontType 1
::nFontWidth 0
::nhFij ( 12 / 3.70 )
::nLinPag 0
::nLMargin 0
::nMaxCol 0
::nMaxRow 0
::nmHor ( 10 / 4.75 )
::nmVer ( 10 / 2.35 )
::nTMargin 0
::nUnitsLin 1
::nvFij ( 12 / 1.65 )
::nwPen 0.1 pen width in MM, do not exceed 1
Important note:
Beware that TPRINT creates a MODAL hidden window to prevent recursive calls.
For this reason you must be very careful with the creation of other MODAL windows
between ::BeginDoc() and ::EndDoc(). If you fail to release them before ::EndDoc()
a RTE will be rised stating that "Non top modal window *_MODALHIDE* can't be released."