Recent

Author Topic: [Solved] Lazreport - Tabsheet to Image  (Read 328 times)

Petrus Vorster

  • Full Member
  • ***
  • Posts: 171
[Solved] Lazreport - Tabsheet to Image
« on: October 13, 2025, 10:37:22 am »
Hi all

I have read here that one has to output a chart to a lazreport as an image.

I have a Tabsheet with statistical data and two charts and it would be much simpler if i can just output an image of the tabsheet to the report instead of linking up data, since everything is already there.
How would you go about doing that?

Thank you for all the help.

-Peter
« Last Edit: October 13, 2025, 12:30:27 pm by Petrus Vorster »

wp

  • Hero Member
  • *****
  • Posts: 13209
Re: Lazreport - Tabsheet to Image
« Reply #1 on: October 13, 2025, 11:41:34 am »
There's a demo covering this: (lazarus)/components/tachart/demo/lazreport

Petrus Vorster

  • Full Member
  • ***
  • Posts: 171
Re: Lazreport - Tabsheet to Image
« Reply #2 on: October 13, 2025, 11:51:15 am »
HI

That was my first goto this morning.
This section in the create:
Code: Pascal  [Select][+][-]
  1.     bmp := TBitmap.Create;
Works perfectly in the example.

I added all the requirements in my project, but it keeps on giving an error on that.
Logically I needed only to change the parameters to the tabsheet instead of the Chart sizes.

Obviously something i am missing again.

-Peter

Petrus Vorster

  • Full Member
  • ***
  • Posts: 171
Re: Lazreport - Tabsheet to Image
« Reply #3 on: October 13, 2025, 12:00:58 pm »
Ok, now I am confused.

I had Graphics listed under USES for the form.
It kept on throwing an error on the Tbitmap.create function.

Then I deleted the entry and added it again at the end of my list of 'uses' and now it works fine.

Why in the world would that be the case?

-Peter

wp

  • Hero Member
  • *****
  • Posts: 13209
Re: Lazreport - Tabsheet to Image
« Reply #4 on: October 13, 2025, 12:09:07 pm »
You probably have unit Windows in your uses clause, too. It contains its own - different - declaration of TBitmap. When you "use" both Windows and Graphics it is important to have Graphics after Windows because the compiler picks the last declaration. Ideally, use Windows as first unit at all because there are other conflicts.

BTW, is it really necessary to have Windows in the uses clause? Maybe you can replace it by LCLIntf and LCLType which are cross-platform.
« Last Edit: October 13, 2025, 12:10:56 pm by wp »

Petrus Vorster

  • Full Member
  • ***
  • Posts: 171
Re: Lazreport - Tabsheet to Image
« Reply #5 on: October 13, 2025, 12:30:01 pm »
Ok, now I understand.
Thank you.

Let me remove the Windows reference and see what happens.
PS, the image to report works great now.

Thanks- Peter

 

TinyPortal © 2005-2018