trichview.com

trichview.support




Re: RV print compatability


Return to index


Author

Message

Sergey Tkachenko

Posted: 03/09/2002 0:06:20


Translation RichEdit messages is possible, but would be very unefficient.


There is a component which can do the desired work - TRVReportHelper.


RichEdit:

EM_FORMATRANGE - prepares document to draw some part of document on the

specified rectangle on the cpecified DC.

RichView:

TRVReportHelper:

   helper.Init(Canvas, Width);

   while helper.FormatNextPage(Height) do;

This code does the similar work as EM_FORMATRANGE. Canvas defines a target

device to format for, Width and Heights (heights can be different) define

rectangles to draw. Heights and width are defines in pixels, but it's easy

to convert them to twips and back.

After calling this code, ranges of items can be referred as page numbers, 1

... helper.PagesCount.


RichEdit:

EM_FORMATRANGE/EM_DISPLAYBAND - draws the specified range of items

RichView:

helper.DrawPage(PageNo, Canvas, Preview, Height);

In order to set position to print, use

SetViewportOrgEx(Canvas.Handle,Left,Top,nil);


If you want to scale image (for example, for drawing a preview on the

screen), use

  SetMapMode(Canvas.Handle,MM_ANISOTROPIC);

  SetWindowExtEx(Canvas.Handle, Width, Height,nil);

  SetViewportExtEx(Canvas.Handle, PreviewWidth, PreviewHeight,nil)

  SetViewportOrgEx(Canvas.Handle,PreviewLeft,PreviewTop,nil);

  Canvas.Font.PixelsPerInch := target device's pixels per inch.


Set Preview parameter to True when drawing on screen, False - on printer.


Here is a demo showing TRVReportHelper:

http://www.trichview.com/support/files/toimage.zip

But this demo is very simplified: it is limited to one frame and screen

resolution.


> We are switching to RichView from RichEdit98, but are using ReportBuilder

> (Piparti) for printing. We made the required RichEdit98 print support

> classes for ReportBuilder and now need to do the same for RV. That trouble

> is that because RV is not derived from the windows richedit, it does not

> support the EM_FORMATRANGE message as in "Result :=

> FRichView.Perform(EM_FORMATRANGE, liRender, Longint(@lFormatRange))" for

> rendering a specified area (in TWIPS) on the specified device and

returning

> the next character position no (as the next character for the next area).

We

> thus need to implement something similar for RV and on the face of it, it

> does not seem to be a major hurdle.

>

> We would appreciate some advice on how to go about this, ie as a

> TCustomPrintableRVData derivative?  Supporting EM_FORMATRANGE will

certainly

> go a long way to enhancing RV compatabilty. How about a wrapper/derivative

> that implements and translates the basic richview properties and methods

> where not completely irrelevant?

>

>





Powered by ABC Amber Outlook Express Converter