Hi Mohammad,
Thank you for interesting in Syncfusion products
We have checked your query “Is it possible to only print selected records using GridPrintDocumentAdv? Any help would be much appreciated” at our end. As per the current implementation of GridGroupingControl does not have any direct support to print the selected records in print preview page. However, this can be achieved by creating a DataTable manually and adding selected records to a datatable. Populate the selected records datatable to a GridGrouping control and print the selected records in print preview page. You can refer the following code snippet to get the selected records in a datatable.
Code Snippet
public DataTable DataTable()
{
DataTable dt = new DataTable("SelectedRecordsTable");
foreach (GridColumnDescriptor desc in this.gridGroupingControl1.TableDescriptor.Columns)
{
dt.Columns.Add(desc.Name);
}
for (int i = 0; i < this.gridGroupingControl1.Table.SelectedRecords.Count; i++)
{
DataRow dr = dt.NewRow();
foreach (GridColumnDescriptor desc in this.gridGroupingControl1.TableDescriptor.Columns)
{
dr[desc.Name] = this.gridGroupingControl1.Table.SelectedRecords[i].Record.GetValue(desc.MappingName);
}
dt.Rows.Add(dr);
}
return dt;
} |
We have attached the tested sample for your reference and you can download the same from the following location.
Thanks & Regards,
Balamurugan Thirumalaikumar