Recent

Author Topic: [Solved] Dynamic height  (Read 783 times)

lainz

  • Hero Member
  • *****
  • Posts: 3980
[Solved] Dynamic height
« on: March 10, 2022, 12:35:45 am »
Hi, there's a way the detail rows has dynamic height depending on the number of text lines it has?

For example in attached screenshot first row has 2 lines. Other rows has only one line but uses the space of 2 lines, because it doesn't calculate it, it's designed to be 2 lines height.

Any ideas on how to do dynamic height?
« Last Edit: March 10, 2022, 02:00:25 pm by lainz »

dseligo

  • Hero Member
  • *****
  • Posts: 715
Re: Dynamic height
« Reply #1 on: March 10, 2022, 01:01:47 am »
Right click on the band (e.g. Master data) and make sure 'Streched' is checked.
Then right click on your memo field and make sure that 'Streched' and 'Word wrap' is checked.

That should do it.

dseligo

  • Hero Member
  • *****
  • Posts: 715
Re: Dynamic height
« Reply #2 on: March 10, 2022, 01:03:36 am »
And one more thing: design it so it is only one line in height.

GAN

  • Sr. Member
  • ****
  • Posts: 350
Re: Dynamic height
« Reply #3 on: March 10, 2022, 02:42:31 am »
También podes usar el evento OnBeginBand, tuve un caso parecido para imprimir el libro IVA que en algunos casos necesitaba más o menos altura de la banda. Te dejo el código actual que tengo funcionando sin problemas.

You can also use the OnBeginBand event, I had a similar case to print the "IVA" book that in some cases needed more or less height of the band. I leave you the current code that I have working without problems.

Code: Pascal  [Select][+][-]
  1. procedure TFLibCompras.frRepBeginBand(Band: TfrBand);
  2. begin
  3.   if ((Band.Name='MasterData1') and (ZQ.FieldByName('cnetogravado2').AsCurrency<>0)) then
  4.   begin
  5.     Band.Height:=45;
  6.     Exit;
  7.   end;
  8.   if ((Band.Name='MasterData1') and (ZQ.FieldByName('cnetogravado1').AsCurrency<>0)) then
  9.   begin
  10.     Band.Height:=30;
  11.     Exit;
  12.   end;
  13.   if ((Band.Name='MasterData1') and (ZQ.FieldByName('cnetogravado1').AsCurrency=0)) then
  14.   begin
  15.     Band.Height:=14;
  16.     Exit;
  17.   end;
  18. end;
Lazarus 2.0.8 FPC 3.0.4 Linux Mint Mate 19.3
Zeos 7̶.̶2̶.̶6̶ 7.1.3a-stable - Sqlite 3.32.3 - LazReport

lainz

  • Hero Member
  • *****
  • Posts: 3980
Re: Dynamic height
« Reply #4 on: March 10, 2022, 02:00:06 pm »
Thanks, it's solved.

 

TinyPortal © 2005-2018