Page 1 of 1

Printer Orientation after LoadRTF

Posted: Fri Feb 15, 2013 12:26 pm
by AXSchmidt
Is it possible to get the orientation after LoadRTF?

Code: Select all

      RichVReportHelper.RichView.LoadRTF(filename);
      Printer.Orientation := RichVReportHelper.RichView.DocParameters.Orientation;

Posted: Fri Feb 15, 2013 12:53 pm
by Sergey Tkachenko
Make sure that RichVReportHelper.RichView.RTFReadProperties.ReadDocParameters = True

Posted: Fri Feb 15, 2013 1:34 pm
by AXSchmidt
yes, im sure...

in your demo
\Demos\Delphi\Assorted\Printing\Headers
the orientation is not adopted, too

Posted: Sat Feb 16, 2013 11:59 am
by Sergey Tkachenko
Well, it's tricky.
Actually, DocParameters.Orientation = poLandscape means only that DocParameters.Width and Height must be exchanged.
The actual orientation is determined by a comparison of Width and Height.

Code: Select all

if rv.DocParameters.Width>rv.DocParameters.Height then
  if rv.DocParameters.Orientation=poPortrait then
    Printer.Orientation := poLandscape
  else
    Printer.Orientation := poPortrait
else
    Printer.Orientation := rv.DocParameters.Orientation;

Posted: Mon Feb 18, 2013 1:18 pm
by AXSchmidt
Thks!

It work's 8)

But i think you mean:

Code: Select all

if rv.Width>rv.Height then 
cause rv.docparameters dont have width & height!? :?

Posted: Mon Feb 18, 2013 1:36 pm
by AXSchmidt
pleased too early

I've

Code: Select all

      RVRHMain.RichView.RTFReadProperties.ReadDocParameters := True;

      RVRHMain.RichView.LoadRTF(dateiname);

      if RVRHMain.RichView.Width > RVRHMain.RichView.Height then
      begin
        if RVRHMain.RichView.DocParameters.Orientation = poPortrait then
          Printer.Orientation := poLandscape
        else
          Printer.Orientation := poPortrait;
      end else
        Printer.Orientation := RVRHMain.RichView.DocParameters.Orientation;
and my Printer Orientation is always Landscape...

Posted: Tue Feb 19, 2013 7:34 am
by AXSchmidt
Problem solved

Code: Select all

if RVRHMain.RichView.DocParameters.PageWidth > RVRHMain.RichView.DocParameters.PageHeight then
instead of

Code: Select all

if RVRHMain.RichView.Width > RVRHMain.RichView.Height then

Posted: Wed Feb 20, 2013 12:39 pm
by Sergey Tkachenko
Yes, sorry for this mistake.