Hi all,
I want to change how the UltraGridPrintPreview prints the grid. I know that you can change the rows and columns when you use the print method of the ultragrid (in the e parameter that is received) but what we want is the same functionality but for the UltraGridPrintPreview. We want to change the fit of the columns, to remove some borders, to hide some cells, … is it possible?
Thanks
Hello ,
I am not exactly sure what you what to achieve, but UltraGrid has a method PrintPreview, which has the same overrides like Print method. So you could call PrintPreview method with the same parameters which you use when you call Print method.
Please let me know if you have any further questions.
From my experience, the preview simply renders the current grid therefore if you want to change the preview, change the underlying grid first. Then preview it and then when done, revert the grid back to how it was to begin with.
Just an idea.
DSSavant said:From my experience, the preview simply renders the current grid therefore if you want to change the preview, change the underlying grid first. Then preview it and then when done, revert the grid back to how it was to begin with.
That's the hard way. :)
When you print or export the grid, the grid's DisplayLayout is cloned. The cloned Layout is exposed by an event.
In this case, the InitializePrint event of the grid will fire and the event args will give you the layout as e.PrintLayout.
Since this layout is a clone, you can modify it however you like and it will only affect the printout and not the on-screen grid. You can hide columns or rows, resize columns, apply different appearances, etc.