Print Row Auto Height
Attachment: SfDataGrid_fa99aa74.zip
Hi Yapwen,
Thank you for contacting Syncfusion Support.
You can achieve your requirement by overriding the GridPrintManager Class and GetRowHeight method as shown below,
Code Example:
|
syncgrid.PrintSettings.PrintManagerBase = new CustomPrintManager(this.syncgrid); public class CustomPrintManager : GridPrintManager { SfDataGrid dataGrid; GridRowSizingOptions gridRowSizingOptions = new GridRowSizingOptions(); double Height = double.NaN; public CustomPrintManager(SfDataGrid grid) : base(grid) { dataGrid = grid; } protected override double GetRowHeight(object record, int rowindex) { if(record != null) { var actualrowindex = GridIndexResolver.ResolveToRowIndex(this.dataGrid, rowindex); if (this.dataGrid.GridColumnSizer.GetAutoRowHeight(actualrowindex, gridRowSizingOptions, out Height)) { return Height; } } return base.GetRowHeight(record, rowindex); }
|
In GetRowHeight method we have resolved rowindex using ResolveToRowIndex. Since GetRowHeight method receives the RecordIndex value. We will fix this issue in our upcoming release to pass rowindex, so you do not have to use ResolveToRowIndex.
Please find the sample from the following location,
Sample Link: http://www.syncfusion.com/downloads/support/forum/122129/ze/PrintingDemo-142227675
Please refer the below UG doc to customize the GridPrintManager,
UG Link: http://help.syncfusion.com/wpf/sfdatagrid/printing#printing-customization
Regards,
Jayapradha
Thanks for the update.
Please let us know if you need further assistance.
Regards,
Sowndaiyan
- 3 Replies
- 3 Participants
-
YA yapwen
- Feb 18, 2016 03:05 PM UTC
- Feb 23, 2016 01:09 PM UTC