We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Print all full columns of SfDataGrid

Hello,

i have question about printing SfDataGrid. I can't find out a way, how print full table. I need print full table, with all columns and rows, not at one page. In my case i have table with 30 columns and 50 rows. In this topic i attach example file. Thanks for help!

11 Replies

JG Jai Ganesh S Syncfusion Team September 10, 2015 09:14 AM UTC

Hi Martin,


Thank you for using Syncfusion products.


We have analyzed your query and we could not find any attached example file in your update. We suspect that you want to print all the columns and rows and not at one page. You can achieve this requirement by setting the “AllowColumnWidthFitToPrintPage” as false in print settings.


Code Example:


    syncgrid.PrintSettings.AllowColumnWidthFitToPrintPage = false;


UG Link: http://help.syncfusion.com/wpf/sfdatagrid/printing


If we misunderstood your requirement, then could you please share more information about your query? This would be more helpful for us to analyze further.


Thank you,

Jai Ganesh S



MT Martin Tichovsky September 11, 2015 04:03 AM UTC

Hello, i see now. Attachement file not included, because i put WPF.ZIP with upper case of file type and you web not allowed this. With lower case is everything ok.

Now, i try set "AllowColumnWidthFitToPrintPage" before, its works, but not print all rows. If i set this to false, print obtain all columns, but not all rows. Moreover, with three cases in three different sfDataGrid is print preview bad for all data. Now problem is rows, and in my exmple is now problem wrong columns and missing rows. Please, see that. Thank you

Attachment: wpf_a7686353.zip


JG Jai Ganesh S Syncfusion Team September 14, 2015 08:26 AM UTC

Hi Martin,


Thank you for the update.


We have analyzed your query. You can achieve your requirement to print all the columns and rows in one page by setting the PrintScaleOption as FitViewonOnePage like below,


Code Example:

private void PrintPreview_Click(object sender, RoutedEventArgs e)

   {

            this.SfdataGrid.PrintSettings.PrintScaleOption = Syncfusion.UI.Xaml.Grid.PrintScaleOptions.FitViewonOnePage;

            this.SfdataGrid.PrintSettings.AllowColumnWidthFitToPrintPage = false;

            this.SfdataGrid.PrintSettings.AllowRepeatHeaders = true;

            this.SfdataGrid.ShowPrintPreview();

   }


We have also prepared a sample based on this and you can download the sample from the below location,


Sample Link: http://www.syncfusion.com/downloads/support/directtrac/142012/ze/SfGridPrintDemo-661777861


Please let us know if you need further assistance.


Thank you,

Jai Ganesh S



MT Martin Tichovsky September 14, 2015 08:34 AM UTC

Thank you for update, but if i try your example, VS 2013 fail on build with error 

"'Syncfusion.UI.Xaml.Grid.PrintSettings' does not contain a definition for 'PrintScaleOption' and no extension method 'PrintScaleOption' accepting a first argument of type 'Syncfusion.UI.Xaml.Grid.PrintSettings' could be found (are you missing a using directive or an assembly reference?)"

I using Syncfusion components with version v4.0.30319.


MT Martin Tichovsky September 14, 2015 08:37 AM UTC

Correction... Syncfusion components with version 13.1451.0.21


MT Martin Tichovsky September 15, 2015 05:04 AM UTC

Hello, i download new syncfusion version and projects build without problem, but print is still not ok. 

First, columns headers haven't right text. 
Second, still not all pages in print preview. First four columns are only on one page. Others missing. 

Now i using syncfusion components with version 13.2451.0.34

I need print all pages with reading format. If fit all columns on one page, than data are not readable.

Thank you


JG Jai Ganesh S Syncfusion Team September 15, 2015 12:26 PM UTC

Hi Martin,


Thank you for the update.


We have analyzed your queries and please find the responses for your queries as below,


Query 1: (Columns headers haven't right text)

We cannot understand your requirement clearly. Could you please share more details about your query? This would be more helpful for us to proceed further.


Query 2: (Still not all pages in print preview. First four columns are only on one page. Others missing)

We suspect that you have set the AllowColumnWidthFitToPrintPage as false in your application. Hence only the first four columns are viewed in the page. You can show all columns in a page by setting AllowColumnWidthFitToPrintPage as true,


Code Example [C#]:

private void PrintPreview_Click(object sender, RoutedEventArgs e)

 {

       this.SfdataGrid.PrintSettings.AllowColumnWidthFitToPrintPage = true;

       this.SfdataGrid.PrintSettings.AllowRepeatHeaders = true;

       this.SfdataGrid.ShowPrintPreview();

 }


Query 3 :( I need print all pages with reading format. If fit all columns on one page, than data are not readable)


I need print all pages with reading format:

We already mentioned in our last update, you can print all the columns and rows in one page by setting the PrintScaleOption as FitViewonOnePage.


If fit all columns on one page, than data are not readable:

If we have more columns in a Grid, then it will compress and fit in one page. You can view these columns by increasing the zooming level or increasing the page size. This is the default behavior of our Grid.


Please let us know if you need further assistance.


Thank you,

Jai Ganesh S



MT Martin Tichovsky September 16, 2015 04:47 AM UTC

Hello,

1. Table in print preview haven't right text. In MainWindow i have Title 2, Title 3, ... and if i print datagrid, all these columns have text Title. I suppose that column header text haven't  nothing common with HeaderText attribute in MainWindow.xml and "GridTextColumn" element.

2. and 3. If i need print all pages with readable format, thats means in print. If i print example with you code, rows and columns are short, not readable. This is not about zoom in print preview. This thread is about print full datagrid = all columns, all rows with readable text on a papers. I don't would like print all data on just one page. I would like print full data on many pages. 

If i set in example and print preview "No Scaling" and print datagrid, than printing data not contains all data in a real table in MainWindow.

And i have one more problem with threading. In attachment i have simple example. I have two threading, this is important and must stay in threading, because i run more that one window in same time. Problem is in MainWindow, in Print Preview. If i now viewing Print Preview and i click on Print, program collapse with error. This error is about thread, i now, but i don't find any possible way to set print in thread. This is now more important. In search solution, please, obeserve threading in App.xaml.cs.

Thank you for help!

Attachment: SfGridPrintDemo_4e9a3a29.zip


JG Jai Ganesh S Syncfusion Team September 18, 2015 01:25 AM UTC

Hi Martin,

We analyzed your queries. A support incident to track the status of this query has been created under your account. Please log on to our support website to check for further updates

https://www.syncfusion.com/account/login?ReturnUrl=/support/directtrac/incidents

Please let me know if you have any questions.

Thank you,
Jai Ganesh S


RG Rahul Gadhe replied to Martin Tichovsky April 4, 2018 10:40 AM UTC

Thank you for update, but if i try your example, VS 2013 fail on build with error 

"'Syncfusion.UI.Xaml.Grid.PrintSettings' does not contain a definition for 'PrintScaleOption' and no extension method 'PrintScaleOption' accepting a first argument of type 'Syncfusion.UI.Xaml.Grid.PrintSettings' could be found (are you missing a using directive or an assembly reference?)"

I using Syncfusion components with version v4.0.30319.

Please let me download


JG Jai Ganesh S Syncfusion Team April 5, 2018 01:10 PM UTC

Hi Rahul, 
 
We have checked our provided sample in VS 2013 with .NetFramework 4 but we are unable to reproduce the issue. Could you please confirm in which Syncfusion version you have used in your application because we have provided the PrintScaleOption in PrintSettings from our 13.2.0.29 version only. If you are using the older version then could you please upgrade any of our latest version using the below link, 
 
 
Regards, 
Jai Ganesh S

Loader.
Live Chat Icon For mobile
Up arrow icon