I am using UltraWinGrid 8.3 and have the following issue:1. The user clicks on a column header at the border to auto resize column so that all text for every row shows on the grid.2. the user calls print preview.3. The last character of the value is cut off in the print preview even though it was not in the grid.I know that I can set "displaylayout.Override.CellMultiLine" to true and have it wrap to the next line but I want it to show all on one line like it does in the grid.
The problem here is that the width of the column on-screen is no good for printing, because the units used in measuring text on-screen is different than the ones the printer is using.
So if you just print the grid using the on-screen column widths, things may not fit.
To get around this, what you can do is handle InitializePrint and/or InitializePrintPreview. These events hand you a Layout, which is a copy of the grid's on-screen DisplayLayout. This is really great, because you can chance the print layout without altering the on-screen layout. And so you can change, or in this case auto-size the column widths for printing. You just loop through the columns on the print layout bands and call PerformAutoSize on each one. The layout knows it's a print layout and will size the columns using the proper printing measurements.
How many columns do you have in the grid? I would say if you have more columns then either you can change the layout of the page or set the page margins accordingly:
Try setting out below properly and see if this will help you:
e.DefaultLogicalPageLayoutInfo.FitWidthToPages = 1
That will help if the grid as a whole is being cut off. However, my problem is the text within a cell is being cut off. This happens when the user double clicks on the column header border to auto adjust the width of the column to match the longest value.
If you have grid text which is greater than the width of the page area, then you can change the page layout to show everything on a single page in Lanscape mode. Try setting following property in InitializePrint event of the grid:
e.PrintDocument.DefaultPageSettings.Landscape =
True