Hello,
the UltraGridPrintDocument should print WYSIWYG by default, that's what I thought. But printing a Grid, where all the columns are displayed correctly on screen, takes away 1 character from the values in almost every column when printed (or in the PrintPreview). Now, the values are shortened and an ellipsis is shown.
That's all I coded:ultraGridPrintDocument.Grid = this.gridReport;ultraGridPrintDocument .Print();
Is there an easy way to get WYSIWYG, instead of working around in InitializePrint or InitializePrintPreview with column.PerformAutoResize?
Thanks for your help!
Is there a way to tell which columns have been autosized and which the user has sized?If not can you tell what the autosize width will be without actually performing one?
If a user has shrunk a column down, I'd like to leave that as it is.They may have shrunk a wide text column down so the print fits on a page...I suppose I'll still get the problem with the print width being very slightly smaller though.In this case I may add a bit onto the width and hope for the best.
If the column is autosized, I'll call PerformAutoResize on it.
I can confirm the behavior is odd with PerformAutoResize and printing.
With
PrintDoc.FitWidthToPages = 1
the behavior I see is that the column size that resolves is too small for the cell. I work around this by looping through each column in the band:
CurrentBand1Column.MinWidth = CurrentBand1Column.CellSizeResolved.Width + 8 CurrentBand1Column.MaxWidth = CurrentBand1Column.CellSizeResolved.Width + 8
and then performing the autoresize a 2nd time.
Unfortunately, I still have an issue where instead of fitting the width nicely to the page, it extends the last column to the width of the internal grid, and then zooms way out to fit it on a page.
Jordan.
It is not working.
My Grid is in split container. i have only 3 columns.
Grid.AutofityStyle = ExtandedLastColumn.
I did steps accordint as you said. But didnt work. Following is the code
{
}
e.DefaultLogicalPageLayoutInfo.FitWidthToPages = 1;
The grid DOES print WYSIWYG. The problem is that the screen uses different drawing units than the printer. So the width of the column on-screen may fit the text perfectly, but when the same width is used on a printer, the text may not fit the same.
Calling PerformAutoResize on each column on the print layout accounts for this, since the print layout knows to use printer metrics and not screen metrics.