Recent

Author Topic: [SOLVED] LazReport Dynamic Height Memo  (Read 1917 times)

pixelink

  • Hero Member
  • *****
  • Posts: 1260
[SOLVED] LazReport Dynamic Height Memo
« on: May 12, 2019, 10:33:15 pm »
After trying to unsuccessfully getting a Memo.Text long text string to be able to print on multiple pages directly on a Printer.Canvas, I tried the LazReport.

Placed a memo on the blank page, with NO bands... resized to fit entire page... WORKS!!!

However, I need the Memo text to be forced to second page if text is longer than what can fit on one page.

So, knowing how to use Crystal Reports, and since LazReport is very similar, I set the "Detail" band to stretch & force new page. I placed a memo rectangle on the detail band.Set it also to stretched and word wrap. The height of the memo box is about 4 lines.

Save report, then run app... NOTHING.... BLANK PAGE

Seriously, what is wrong now.

Why is it so difficult to just get a plain old long text string to print on multiple pages.
This should work out of the box.
 :o
« Last Edit: May 12, 2019, 11:02:52 pm by pixelink »
Can't Type - Forgetful - Had Stroke = Forgive this old man!
LAZ 2.2.0 •  VSSTUDIO(.Net) 2022 • Win10 • 16G RAM • Nvida GForce RTX 2060

pixelink

  • Hero Member
  • *****
  • Posts: 1260
Re: LazReport Dynamic Height Memo
« Reply #1 on: May 12, 2019, 10:53:57 pm »
Okay... changed out "Detail "Data" for "Master Data" band, removed forced page from bands, yielded 3 pages.
See screen.

Why is this doing this?
Can't Type - Forgetful - Had Stroke = Forgive this old man!
LAZ 2.2.0 •  VSSTUDIO(.Net) 2022 • Win10 • 16G RAM • Nvida GForce RTX 2060

pixelink

  • Hero Member
  • *****
  • Posts: 1260
Re: LazReport Dynamic Height Memo
« Reply #2 on: May 12, 2019, 11:02:35 pm »
Found the issue, which I could not find docs for.

I had to set band to "Break"

« Last Edit: May 12, 2019, 11:10:42 pm by pixelink »
Can't Type - Forgetful - Had Stroke = Forgive this old man!
LAZ 2.2.0 •  VSSTUDIO(.Net) 2022 • Win10 • 16G RAM • Nvida GForce RTX 2060

pixelink

  • Hero Member
  • *****
  • Posts: 1260
Re: [SOLVED] LazReport Dynamic Height Memo
« Reply #3 on: May 12, 2019, 11:09:46 pm »
Here is how to get it done...

1) Place Memo1, button and lrfReport on form.
2) Double-click the lrfReport components on form
3) After designer opens add "Master Data" band, right click and select "Stretched" and "Break"
4) Add a rectangle on the Master Data band, right-click and select "Stretched" & "wordwrap"
5) Add this code to project...

Code: Pascal  [Select][+][-]
  1.  
  2. procedure TForm1.Button1Click(Sender: TObject);
  3. begin
  4.   frReport1.LoadFromFile('printmemo.lrf');
  5.   frReport1.ShowReport;
  6. end;
  7.  
  8. procedure TForm1.frReport1EnterRect(Memo: TStringList; View: TfrView);
  9. begin
  10.   if (View is TfrMemoView) then
  11.    if (View as TfrMemoView).Name = 'Memo1' then
  12.      (View as TfrMemoView).Memo.Text := Memo1.Lines.Text;
  13. end;
  14.  
  15.  

Wah-La... it works perfectly!!
« Last Edit: May 12, 2019, 11:14:48 pm by pixelink »
Can't Type - Forgetful - Had Stroke = Forgive this old man!
LAZ 2.2.0 •  VSSTUDIO(.Net) 2022 • Win10 • 16G RAM • Nvida GForce RTX 2060

 

TinyPortal © 2005-2018