Forum > LazReport

[Solved] Dynamic height


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?

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.

And one more thing: design it so it is only one line in height.

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  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TFLibCompras.frRepBeginBand(Band: TfrBand);begin  if ((Band.Name='MasterData1') and (ZQ.FieldByName('cnetogravado2').AsCurrency<>0)) then  begin    Band.Height:=45;    Exit;  end;  if ((Band.Name='MasterData1') and (ZQ.FieldByName('cnetogravado1').AsCurrency<>0)) then  begin    Band.Height:=30;    Exit;  end;  if ((Band.Name='MasterData1') and (ZQ.FieldByName('cnetogravado1').AsCurrency=0)) then  begin    Band.Height:=14;    Exit;  end;end;

Thanks, it's solved.


[0] Message Index

Go to full version