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

Exclude Columns when Exporting using Check Boxes

i use this code to achieve what i want 

        PdfExportingOptions GridPdfExportingOptions = new();

        private PdfExportingOptions PdfExportingOptions()



            return GridPdfExportingOptions;


        private void SkipColumns()


            if (ChkAddress.Checked)





        private void Export_Click (object sender, EventArgs e)


            var document = new PdfDocument();

            document.PageSettings.Orientation = PdfPageOrientation.Landscape;

            var page = document.Pages.Add();

            var PDFGrid = DGV_Student.ExportToPdfGrid( DGV_Student .View, PdfExportingOptions());

            var format = new PdfGridLayoutFormat()


                Layout = PdfLayoutType.Paginate,

                Break = PdfLayoutBreakType.FitPage


            PDFGrid.Draw(page, new PointF(), format);

            SaveFileDialog saveFileDialog = new SaveFileDialog


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


            if (saveFileDialog.ShowDialog() == DialogResult.OK)


                using (Stream stream = saveFileDialog.OpenFile())






that code only works if the box is checked..

what i want is, the code should work when the box is checked and unchecked. how to achieve it?

Thanks :)

3 Replies 1 reply marked as answer

SJ Sathiyathanam Jeyakumar Syncfusion Team December 14, 2022 04:57 PM UTC


We have checked the reported issue and found that once we added the column names to an ExcludeColumn list, then we should remove them from the ExcludeColumn list if you also want to export it. You can fix the problem by intialize the ExcludeColumns list while call the SkipColumns method or else remove the added column names from ExcludeColumns list. Refer to the below code snippets and a sample.

Attachment: Samplerelationsfdatagrid_4cfe6dea.zip

Marked as answer

RI RIDWAN replied to Sathiyathanam Jeyakumar December 15, 2022 05:36 AM UTC

thanks for taking the time to answer my question, what you provided really worked. :)

VS Vijayarasan Sivanandham Syncfusion Team December 16, 2022 03:30 AM UTC


We are glad to know that the reported problem has been resolved at your end. Please let us know if you have any further queries on this. We are happy to help you😊.

Live Chat Icon For mobile
Up arrow icon