Hi,
Can anybody explain whether Is there a way to print the Grid by AutoSizing itself. Right now I am using Crystal Reports but it will not autosize the content based on the paper size of the printer. I want something which shrinks the data based on paper size of the printer and then print.
If so ultraGrid has this functionality, also help me in telling me how to include header and footer like we do in crystal reports.
If it does not, let me know if any of the softwares or report viewers provide me with this functionality
Yes, the grid does this.
You can call the Print or PrintPreview method on the grid and then handle the appropriate event: InitializePrint or InitializePrintPreview respectively.
To get the grid to fit within a single page, you use the FitWidthToPages property on the DefaultLogicalPageInfo. This object also has properties for the page header and footer.
private void ultraGrid1_InitializePrintPreview(object sender, CancelablePrintPreviewEventArgs e) { e.DefaultLogicalPageLayoutInfo.FitWidthToPages = 1; e.DefaultLogicalPageLayoutInfo.PageHeader = "Header"; e.DefaultLogicalPageLayoutInfo.PageFooter = "Footer"; }
This works fine but actually I want to use ultragrid printpreview dialog but these settings are getting applied to default vb printpreview dialog. How can I change this.
If you are launching the grid to an external print preview dialog, then InitializePrintPreview in the grid won't fire. Use InitializePrint, instead. The same code should work in that event.