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

Export GridDataControl to PDF

 How would I export a griddata control to a pdf?


Steve


1 Reply

RG Rajasekar G Syncfusion Team May 25, 2012 12:42 PM UTC

Hi Steven,

 

Thanks for your update .

 

You can achieve your requirement by using the following code snippet.

 

Code Snippet:

SaveFileDialog sfd = new SaveFileDialog

        {

            DefaultExt = ".pdf",

            Filter = "Adobe PDF Files(*.pdf)|*.pdf",

            FilterIndex = 1,

            RestoreDirectory = true

        };

        PdfDocument document;

        if (sfd.ShowDialog() == true)

        {

            using (Stream stream = sfd.OpenFile())

            {

                document = this.dataGrid.Model.ExportToPdfGridDocument(GridRangeInfo.Table());

                document.Save(stream);

                Process.Start(sfd.FileName);

            }

        }

 

 

we have created a sample application using this and it can be downloaded from the below location.

 

Sample location: ExportToPDF.zip

 

Please let us know if you have any questions.

 

Thanks,

Raja sekar.G


Loader.
Live Chat Icon For mobile
Up arrow icon