Recent

Author Topic: TGridPrinter is printing beyond right margin.  (Read 400 times)

Awesome Programmer

  • Sr. Member
  • ****
  • Posts: 479
  • Programming is FUN only when it works :)
    • Cool Technology
TGridPrinter is printing beyond right margin.
« on: May 02, 2025, 06:01:32 pm »
I have a TStringGrid on the form and want to use TGridPrinter component to print the grid. However, the grid goes beyond the right of the margin.
The bleeding grid to the right is printed on a different pages. I don't want TGridPrinter to do that.

TGridPrinter I am using is GridPrinterPkg 0.6

Is there a way to tell TGridPrinter to IGNORE printing anything that goes past right margin? So, it only prints what is within the Margin.

Thanks,

wp

  • Hero Member
  • *****
  • Posts: 13485
Re: TGridPrinter is printing beyond right margin.
« Reply #1 on: May 02, 2025, 09:00:07 pm »
You are right: TGridPrinter was designed to print the entire grid and distribute it over several pages if needed. For the case that only some given cell block is to be printed there should be properties for StartCol, EndCol, StartRow and EndRow. A patch is welcome.

If there are not too many columns overflowing the right margin, you could consider calling GridPrinter.ScaleToPages(1, -1)  (1 = number of horizontal pages, -1 = no limit in vertical pages). This way the grid is scaled so that its width fits within the page margins.

 

TinyPortal © 2005-2018