=====================================
= RichView Controls for QuickReport =
=====================================


About
=====

QRRichview / QRDBRichview are components for printing RichView documents with QuickReport.

Copyright (c) 2005-2011 Henk van Bokhorst / IVS Systemhouse B.V. and QBS Software. All rights reserved.

Website (TRichView and this component): www.trichview.com
Website (QuickReport): www.quickreport.co.uk
E-mail (regarding this component): qrrvwrapper@xs4all.nl

Website of my company (dutch, does not contain information about this component): www.ivs-systemhouse.nl

These components are freely distributable in source form provided all copyrights and acknowledgements remain intact. The author would also appreciate receiving notification of all changes, improvements or additions made to these components.

If you like these components, you can show me your appreciation by sending me a postcard of your town / country with a nice stamp. You can send it to:
Henk van Bokhorst
Ibislaan 2
NL-3871 TA  Hoevelaken
The Netherlands

These components are developed and tested using Delphi 7, Delphi 2007 and Delphi 2010 in combination with QuickReport 4 and 5 (Professional). It should be compatible with QuickReport 3.6 Professional. It seems not to be compatible with older versions / standard versions of QuickReport, but maybe you can make it compatible. I don't know if it is compatible with other versions of C++ builder or Delphi. And of course you will need RichView...


Installation
============

If you have the QRWrapper (version < 3.00) installed, remove that package from your library and remove the component files (bpl, dcu and source files) of your old version.

You can find the component (source) files in the 'Source' folder.

To install, first, modify the file "QRCtrls.inc" and remove the dot for the QuickReport version you use. Also remove the dots for the graphic formats (GIF, PNG) you use. Note: In older Delphi versions, you need third party components to support these graphic formats. If you don't have the support for a graphicformat installed, don't remove the dot.

Next, open the "RVQRCtrls_RunXXX.dpk" (where XXX is your Delphi version) in Delphi and compile it. Now do the same for "RVQRCtrls_DsgnXXX.dpk". Finally, install the "RVQRCtrls_DsgnXXX.bpl" package.

You can find the QRRichview / QRDBRichview components in your QReport group.

For those that used a version < 3.00: When you compile your projects, the compiler will give you an error that "RVQRWrap" can't be found. This unit is now called "RVQRCtrls". The component name is not changed.


Usage
=====

Create a new QuickReport and drop a QR(DB)RichView component on it. For QRRichview, use one of the Load* methods (see below) to load the data you want to print or use the Text property. For QRDBRichview, assign the DataSet and DataField property to the correct set / field. That's it!

You can also check the demo applications.

Note: The component renders the data as a metafile before printing. When printing directly this gives excellent results, since the metafile is rendered using the printer resolution. However, when you use the preview, the metafile is rendered using the screen resolution. When you print from within the preview, the document is not rendered again, so the quality (although still acceptable) is not optimal. This is by the way a common 'feature' of QuickReport 4.


Properties
==========

The following properties are available (apart from the standard QRPrintable properties).

AutoPages (default True) and AutoStretch (default True): AutoStretch does exactly what you would expect using QuickReport: It stretches the band to fit the complete document (which can of course result in getting more than one page). AutoPages can be used if you don't want to use AutoStretch, but you want to print the report completely, creating more pages if necessary. In this case, you decide the exact dimensions of the QRRichView component on the QuickReport (the component and band are not stretched). If this space is not big enough to hold the document, a new page follows with on the same location and with the same dimensions the next part of the document etc, until the full document is printed. If AutoStretch is True, AutoPages is automatically set to True, since of course enough pages are created to hold the component). If AutoPages and AutoStretch are both False, only that part of the document is printed that fits.

ColorMode (default rvcmPrinterColor): Derived from TCustomRVPrint, possible values:
- rvcmColor: Color output.
- rvcmPrinterColor: Color output, but clWindow is changed to clWhite, clWindowText is changed to clBlack.
- rvcmGrayScale: Colors are converted to shades of gray.
- rvcmBlackAndWhite: Paragraph background is not printed; text is printed black on white or white on black depending on what is darker.
- rvcmBlackOnWhite: Paragraph background is not printed; text is printed black on white.

TransparentBackground (default False): Derived from TCustomRVPrint; If set to True, background will not be printed.

NoMargins (default False): When True, the (top, left, right, bottom) margins of your document are ignored, so it fits the component completely. This makes it easy to align it with other QuickReport components.

DataSet / DataField (only for QRDBRichview): To assign the table / field which contains the RVF or RTF data (the component supports these two formats).

Text (only for QRRichview): Here you can (in design-time) load a RVF or RTF file, which is then stored into the form. Of course, this is not the preferred method for large documents, since it will bloat your application.


Methods
=======

The following methods are available for QRRichview (apart from the standard QRPrintable methods).

function LoadRVFFile(FileName: string): boolean. To load a file that has the RichView Format. True if function succeeds.

function LoadRTFFile(FileName: string): boolean. To load a file that has the Rich Text Format. True if function succeeds.

function LoadRVFStream(Stream: TStream): boolean. To load a stream that contains text in the RichView Tormat. True if function succeeds.

function LoadRTFStream(Stream: TStream): boolean. To load a stream that contains text in the Rich Text Format. True if function succeeds.


QRDesign
========

Note: I did not test or check the QRDesign units, they are created and tested by QBS Software. You can find them in the QRDesign folder.

They gave the following instructions to use the components with QRDesign.

1. Build a QRDesign application or use an exiting one.
2. Add qrd3rdpartycontrol_TRichView to the 'uses' clause of the main form.
3. Add qrd3rdpartycontrol_TRichView.pas to the project.
4. Build the project.

The wrapper will require the source of TRichView and RVQRCtrls.pas to be available, so add the directory of this source to the project search path ( Project / Options menu, Directories&Conditionals tab).

That is all that is required, and the QRRichView will appear on the QRDesign editor toolbar.

To install the DB version add 'qrd3rdpartycontrol_TDBRichView' to the project and repeat these steps.


History
=======

Version 1.00 (2005/06/17)
- First release

Version 1.01 (2005/07/22)
- Made compatible with QuickReport 3.6 and higher (thanks to Eike Hoffmann)
- Included CB6 package and demo (thanks to / made by Eike Hoffmann)
- Bug solved: When the text was divided over several pages, and on the first page there were other components printed before the QRRichView, the top of the QRRichView on subsequent pages was too low.
- Bug solved: The component did not take the non-printable area of a printer into account, therefore the RichView text was printed too far to the right and bottom on most printers, and did therefore not align with other QuickReport components.

Version 1.02 (2005/07/26)
- Bug solved: When you only wanted to print a subrange, not starting with page 1, the text appeared too small on the paper.

Version 1.03 (2005/07/27)
- Bug solved: It was remarkable that on most occasions the last page was printed correctly...

Version 1.04 (2005/07/29)
- Bug solved: Images, lines etc. weren't scaled correctly on the print.
- You can now print to all kinds of printers, no 'out of memory'-errors any more when using postscript printers / faxes etc.

Version 1.05 (2005/08/17)
- Bug solved: Sometimes the last line was not printed completely (thanks to Sergey Tkachenko).

Version 1.06 (2006/02/11)
- Included Delphi 2006 package and demo (thanks to / made by Ralf Bhler).

Version 2.00 (2007/09/12)
- Included Delphi 2005 package (thanks to / made by Gerhard de Waal).
- Included Delphi 2007 package.
- Rewritten so it uses a metafile instead of a bitmap in the "in-between" processing. This is faster and much less memory consuming. Also the "Insufficient resources" problem that occurred with some printers seems to be solved. 

Version 3.00 (2011/05/06)
- Name changed to RVQRCtrls instead of RVQRWrapper, now it contains a run-time and design-time package.
- New property NoMargins (see above)
- New property Text (see above)
- New component QRDBRichview
- Units added to be able to use the components with QRDesign

Version 3.01 (2017/10/28)
- Compatibility with TRichView v15.4 and newer: MetafileCompatibility for TRVReportHelper (change by Sergey Tkachenko)


Known bugs
==========

None!


The future
==========

I created the QRWrapper component since we use QuickReport in all our applications and wanted to keep all document lay-outs / the behavior of all applications consistent.

In 2010 / 2011 QBS Software (the developers of QuickReport) enhanced it a lot (with the Text property and the DB component), and the name was changed to RVQRControls.

Although the final code is in fact quite small and simple, it took me a lot of time to figure out how to create this component. Since these components (at this moment) does what they have to do for me, the chance that I will enhance it in the near future is quite low. However, you never know... 

But you are free to enhance it yourself and there is enough room for enhancements. For example:
A C Builder version (which was lost due to the changes made from version 2 to 3)
Adding a property 'RichView' to which you can assign an existing RichView component (so you don't have to use a load* method).

Please e-mail me your enhancements, so I can implement them with enhancements of others (or my own). The address is: qrrvwrapper@xs4all.nl
