Link to home
Start Free TrialLog in
Avatar of Mike Littlewood
Mike LittlewoodFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Can a quick report label be printed with vertical text easily?

I am trying to print some text in a TQRLabel vertically. Does anyone have an example of this?
ASKER CERTIFIED SOLUTION
Avatar of bokist
bokist
Flag of Hungary image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
oops,  first line must be onPrint event of the label

procedure TForm1.QRLabel1Print(sender: TObject; var Value: String);
Avatar of Mike Littlewood

ASKER

Excellent thanks.
A quick add on to this question bokist.
This solution works fine on screen but when I send it to the printer the text does not seem to stay vertical. Have you had this issue too?
Hi mike!

Unfortunately yes.
I have no explanation for this behaviour.
I find solution for this problem - little bit dirty - but it works.
Usually I have a button(btnReport) and two checkboxes(cbox_print, cbox_preview) on the main form.
In my solution I can print the report directly(without preview),
  or I can have preview -
but then I can print the report only in second step(NOT FROM PREVIEW !) - clicking on btnReport when cbox_Print is checked.
Here is my solution:

procedure TForm1.btnReportClick(Sender: TObject);
var
   Page_cnt : integer;
   Report_file : string;
begin
     Application.CreateForm(TForm2, Form2);
     Report_file := 'c:\Reports\' + Form2.QuickRep1.ReportTitle + '.Qrp';
     Form2.QuickRep1.Prepare;
     Form2.QuickRep1.QRPrinter.Save(Report_file);
     Page_cnt := Form2.QuickRep1.QRPrinter.PageCount;
     if cbox_preview.checked   then  Form2.QuickRep1.Preview;
     if cbox_print.checked    then  Form2.QuickRep1.QRPrinter.PrintMetafileDirect(Report_file,1,Page_cnt);
     Form2.QuickRep1.Free;
     Form2.Close;
end;

I hope the explanation is not too confused, and you can get it work.

Regards,
   Steve
P.S. Excuse me on my poor English.
Almost forget - if you have better solution, please let me know.
Thanks
Ok thanks bokist, I'll let you know if I come up with something a bit more elegant, but in the mean time I will tailor the code you have provided.
Just to let you know bokist, I am about to purchase Quick Reports 5 Pro.
This has standard components to work with rotated labels.
I have tried it into delphi 10.1 with quick report 6, not working, the result is like attached pictures.
1.png - the result of quick report.
2.png - the needed one.User generated imageUser generated image