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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Positioning Exported Grid and fit the colums

Thread ID:

Created:

Updated:

Platform:

Replies:

125417 Aug 16,2016 07:03 AM UTC Aug 17,2016 09:50 AM UTC ASP.NET MVC 1
loading
Tags: Grid
ahmad
Asked On August 16, 2016 07:03 AM UTC

Hi , 
I am facing a problem with positioning the exported grid in the pdf file , I need to set the top margin to 200px for instance , but the exported grid cover the header of the file , 
also I need to set all the columns to be fit in the documents .



 

Jayaprakash Kamaraj [Syncfusion]
Replied On August 17, 2016 09:50 AM UTC

Hi Ahmad, 

Thank you for contacting Syncfusion support. 

While exporting the grid to PDF, we can change the Margin top of the page as “200” by using the below code example. 
   
public void ExportToPdf(string GridModel) 
        { 
            PdfExport exp = new PdfExport(); 
            PdfDocument document = new PdfDocument(); 
            document.PageSettings.Margins.Top =  200; // set Margin top value 
 
            var DataSource = new NorthwindDataContext().OrdersViews.Take(100).ToList(); 
            GridProperties obj = ConvertGridObject(GridModel); 
            exp.Export(obj, DataSource, "Export.pdf", false, false, "flat-saffron", false, false, document, "Grid", false);//here, the 11th parameter is "isAutoFit" which we have set as false.             
        } 

 
We can fit all the Grid columns in a single page by passing the isAutoFit parameter as false to the export method of the PdfExport Class. By default, the isAutoFit property is true. Please refer to the below code example and sample.  
public void ExportToPdf(string GridModel) 
        { 
.. 
            exp.Export(obj, DataSource, "Export.pdf", false, false, "flat-saffron", false, false, document, "Grid", false);//here, the 11th parameter is "isAutoFit" which we have set as false.             
        } 


Regards, 

Jayaprakash K. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;