I am using UltraPrintPreviewDialog to generate report of the UltraWinGrid and it does not show the actual width of the column of the grid on
PrintPreviewDialog.
By clicking on the column header of the grid if we set it to fit to with and then generate the report.The column width on the PrintPreviewDialog is not completely visible.
Hello avlindia,
I wanted to know if you were able to solve your issue based on these suggestions or you still need help. Please let me know.
Hi,
AutoSizing the columns on the screen will not autosize the columns for printing, because the printer uses different units and scaling. So if you just print (or preview) the grid as is, it will be using the columns widths from the on-screen grid and they may be cut off.
The easiest way to solve this problem is to handle the InitializePrint and/or InitializePrintPreview event of the grid and call PerformAutoSize on each column using the e.PrintLayout passed in to the event.
private void ultraGrid1_InitializePrintPreview(object sender, CancelablePrintPreviewEventArgs e) { e.PrintLayout.PerformAutoResizeColumns(false, PerformAutoSizeType.AllRowsInBand); }
I tried this and it always works fine for me so I attached my sample to this post for you. Please review it and feel free to let me know if I misunderstood you or if you have any other questions.
Previous one was grid data and this one is how it looks on UltraPrintPreviewDialog
Plz find the attachment