Autofit the grid in a single page of printDocument?

Aug 17, 2011 at 10:23 AM

my grid has multiple columns which i require to be printed in a single page of the print document .  Is is possible to autofit the columns to fit in a single page while printing rather than printing those columns on next page? 

Aug 23, 2011 at 6:40 AM

Printing has very limited supported at the moment.

Nov 17, 2011 at 7:58 AM
Edited Nov 17, 2011 at 8:00 AM

i made some adjustments for the printing :

on the file: gridPrintDocument.cs look for,

protected virtual void DrawCell(Graphics g, CellContext ctx, RectangleF rect)
inside  look for condition if ( ctx.Cell.View is SourceGrid.Cells.Views.Cell ) 

inside it there i added m_CellPrintView.Font= ((Cells.Views.Cell)ctx.Cell.View).Font;

Now what i did was while drawing the grid , adjusted the font size enough so that the grid would fit the page, also adjust the margins from print pages' property. 

This pretty much solves the problem bt there is also another problem with font sizes that is if u draw gid with font size 7 and while printing it prints with font size 7.25 for which i dont know what to do!!.

THis causes the grid lines to hide some of the text since the grid spacing does not grow with the font ..

Hope source grid will have support for printing as well in the future


Nov 21, 2011 at 10:03 AM

Feel free to fork SourceGrid repository and and make your changes there. Sending a pull request would be welcome :)

Link to the official repo: