Hi,
I've got a grid that displays hierarchical information and I want to be able to show it in a print preview dialog and print it. The grids rows are expanded for this print.
The data is a process hierarchy. It is based on a process hierarchy class which can have a collection of process hierarchy classes. It shows Process Name, Position and Value. Each band therefore shows the same columns.I’ve managed to display the grid in print preview, added a simple header, change the paper size and orientation but it’s printing 2 blank pages between printed sheets. I changed the FitToWidthPages on the document to 1 and it got rid of the blank pages. Now the print has resized, the data is barely readable.
The grids default column sizes were too large so I wanted to resize them in the designer, but I couldn’t work out how to resize one band so it applies to each band beneath it, as the number of bands are going to be variable. I decided to change the columns on the BeforeRowExpanded event to : e.Row.Band.Columns(0).Width = 300, e.Row.Band.Columns(1).Width = 200, e.Row.Band.Columns(2).Width = 100I’m assuming that the grid has sized itself based on the column widths in the designer. Is there anyway of resizing the grid to reflect my code driven column widths or is there another way to deal with the column and grid sizing?
I can appreciate that the grid needs to be wide enough to encompass the furthest indented band and therefore there will be whitespace on pages that don’t display this band. In the end of the day all I want to do is remove unnecessary whitespace.
Nathan
Hello Nathan,
You could use the 'PerformAutoResizeColumns()' method to achieve the desired look. Something similar to the following code sample:
ultraGrid1.DisplayLayout.PerformAutoResizeColumns(false, Infragistics.Win.UltraWinGrid.PerformAutoSizeType.AllRowsInBand, Infragistics.Win.UltraWinGrid.AutoResizeColumnWidthOptions.All);
Please feel free to let me know if I misunderstood you or if you have any other questions.