Print all data in the DataGrid in WPF
<p>I am working on WPF application. I have data in the DataGrid which I have to print all the data present in it. I tried like this...</p>

<pre><code>publicMainWindow()
    {
       InitializeComponent();

       DataTabledt = newDataTable();
       dt.Columns.Add("S.No");
       dt.Columns.Add("Name");
       dt.Columns.Add("Father's Name");
       dt.Columns.Add("D-O-B");
       dt.Columns.Add("Qualification");
       dt.Columns.Add("Gender");
       dt.Columns.Add("SSC %");
       dt.Columns.Add("+2 %");
       dt.Columns.Add("Graduation %");
       dt.Columns.Add("Work Experience");
       dt.Columns.Add("Company");

       object[] rowValues = {"01","Gopi","Ravi","31","Degree","M", "88","85", "80","2 Years","Blah Blah"};

       dt.Rows.Add(rowValues);
       dt.AcceptChanges();
       myGrid.DataContext = dt.DefaultView;
    }

       privatevoidPrint_Click(object sender, RoutedEventArgs e)
    {
       PrintDialogprintDlg = newPrintDialog();
       if ((bool)printDlg.ShowDialog().GetValueOrDefault())
        {
       Sizepagesize = newSize(printDlg.PrintableAreaWidth,printDlg.PrintableAreaHeight);
       myGrid.Measure(pagesize);
       myGrid.Arrange(newRect(5, 5, pagesize.Width, pagesize.Height));
            printDlg.PrintVisual(myGrid, "Personal Information");

        }
    }
</code></pre>

<p>when I click on print button it is printing only the data which we can see as below <a href="https://i.stack.imgur.com/JJNwQ.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JJNwQ.jpg" alt="enter image description here"></a></p>

<p>But in my case it is not printing work experience and company columns. How can I Print all the fields. Please help me out</p>

<p>EDIT: I think FlowDocument is used, but suppose I have 50 rows I cannot use FlowDocument. How can I Print in this case.</p>