Hi dears,
I use SfDatagrid in my application and when I printing SfDatagrid, its going to print data.
I need to print data and row summary and group summary.
Hi Hossein,
In SfDataGrid, the summary rows will be printed by default when printing the entire SfDataGrid. We have prepared a sample for this. Please have a look at the attached sample and let us know if you require further assistance.
Regards,
Mohanram A.
The summary rows will be printed by default when printing the entire SfDataGrid but Group Summary will not printed.
Also when we use SfDataPager and wants to print one page of SfDataGrid rows summary and group summary will not printed.
my code :
public void PrintDataGrid(object parameter)
{
try
{
var DataGrid = parameter as SfDataGrid;
DataGrid.PrintSettings = new Syncfusion.UI.Xaml.Grid.PrintSettings();
DataGrid.PrintSettings.PrintManagerBase = new CustomPrintManager(DataGrid);
DataGrid.PrintSettings.AllowRepeatHeaders = true;
DataGrid.ShowPrintPreview();
}
catch { }
}
}
public class CustomPrintManager : GridPrintManager
{
public CustomPrintManager(SfDataGrid grid) : base(grid) { }
protected override IList GetSourceListForPrinting()
{
return View.Records.ToList();
}
}
Hi Hossein,
The reported problem occurs due to returning the View.Records.ToList() in
customization of PrintManager. As we mentioned earlier In SfDataGrid, the
summary rows will be printed by default when printing the entire SfDataGrid.
Please revert to us with the below mentioned details.
Details about the purpose of customizing PrintManager.
Complete code snippet related to SfDataGrid (Xaml & Code behind)
It will be more
helpful for us to find the exact cause for the issue and to provide a prompt
solution.
Regards,
Dhanasekar M.
I use a SfDataGrid (Group by 'Name' , Group summary , Rows summary ) with a SfDataPager exactly like this picture:
I want to print SfDataGrid with group summary and rows summary like bellow picture. Also when I print SfDataGrid just print current page (active page in SfDataPager) not all rows. Just current page with group summary and rows summary.
this is my purpose print result.
Hi Hossein,
Currently, we are checking the feasibilities to achieve your requirement. We will check and update you further details on April 19, 2022.
Regards,
Dhanasekar M
Hi
Hossein,
Still, we are checking on this. We will check
and update you further details on April 21. 2022.
We appreciate your patience and understanding.
Regards,
Dhanasekar M.
Hi Hossein,
We have checked the feasibilities to achieve your requirement “Print the active
page with the summaries” in our end. We also regret to inform you that, our
SfDatagrid source architecture does not provide support to achieve your
requirement.
Regards,
Dhanasekar M.
Thanks for your responsibility.
It's not possible to print " Print the active page with the summaries" or SfDataGrid does not support print "Group summary"?
Can I print group summary and row summary without SfDataPager (print all rows binding to SfDataGrid with rows summary and group summary)?
Hi Hossein,
You can print the group summaries by two ways like below,
Case 1 :
If you print all group summaries you need to expand all groups before printing
with the help of AutoExpandGroups property shown in below example,
Xaml :
|
<syncfusion:SfDataGrid Name="dataGrid" AllowFiltering="True" AutoExpandGroups="True" ShowGroupDropArea="True" ColumnSizer="Auto"
ItemsSource="{Binding OrdersListDetails}" /> |
C#:
|
dataGrid.ShowPrintPreview(); |
Case 2:
You can print entire grid with its summaries using below code,
C#:
|
PdfViewerControl pdfviewer = new PdfViewerControl(); MemoryStream pdfstream = new MemoryStream(); var document = dataGrid.ExportToPdf(); document.Save(pdfstream); pdfviewer.Load(pdfstream); dataGrid.ShowPrintPreview(); |
We have modified the sample based on your scenarios. Please check the sample
and revert us if you need further assistance for this.
Regards,
Dhanasekar M.