To reproduce:
- Set the AutoSizeRows and PrintGrouping properties to true.
- Add a group descriptor and then call the PrintPreview method of the grid.
Workaround:
- Use the following classes to create custom print style:
public class MyGridPrintRenderer : TableViewDefinitionPrintRenderer
{
private RadGridView gridView;
public MyGridPrintRenderer(RadGridView grid) : base(grid)
{
gridView = grid;
}
protected override int GetDataRowHeight(GridViewRowInfo row, TableViewRowLayoutBase rowLayout)
{
IVirtualizedElementProvider<GridViewRowInfo> rowElementProvider = this.gridView.TableElement.RowScroller.ElementProvider;
GridRowElement visualRow = rowElementProvider.GetElement(row, null) as GridRowElement;
if (visualRow is GridGroupHeaderRowElement)
{
return rowLayout.GetRowHeight(row);
}
return base.GetDataRowHeight(row, rowLayout);
}
}
public class MyGridPrintSyle : GridPrintStyle
{
protected override BaseGridPrintRenderer InitializePrintRenderer(RadGridView grid)
{
if (this.PrintRenderer != null)
{
this.PrintRenderer.PrintCellPaint -= renderer_PrintCellPaint;
this.PrintRenderer.PrintCellFormatting -= renderer_PrintCellFormatting;
}
MyGridPrintRenderer renderer = new MyGridPrintRenderer(grid);
renderer.PrintCellFormatting += renderer_PrintCellFormatting;
renderer.PrintCellPaint += renderer_PrintCellPaint;
return renderer;
}
private void renderer_PrintCellPaint(object sender, PrintCellPaintEventArgs e)
{
this.OnPrintCellPaint(sender, e);
}
private void renderer_PrintCellFormatting(object sender, PrintCellFormattingEventArgs e)
{
this.OnPrintCellFormatting(sender, e);
}
}