title: Using DevExpress XtraPrint to print the data in a GridControl with two associated GridViews
body: <p>I am currently programming within Visual Studio 2010 using VB.Net and DevExpress V10.2 Winforms. I currently have a DevExpress GridControl that contains two DevExpress GridViews. So there is the main view and the subgrid (similar to the DevExpress demo for Master-Detail Grids - example with <a href="http://www.devexpress.com/products/net/controls/winforms/grid/build.xml" rel="nofollow">WinForms</a> and better view with <a href="http://demos.devexpress.com/ASPxGridViewDemos/MasterDetail/MasterDetail.aspx" rel="nofollow">ASPxGridView</a>). Currently the data for the grid is fetched into a DataSet:</p>
  
  <pre><code> If myDataSet.Tables.Count &gt; 0 Then
         myDataSet.Relations.Add("Details", myDataSet.Tables(0).Columns("id"),  myDataSet.Tables(1).Columns("id"))
         myGridControl.DataSource = myDataSet.Tables(0)
         myGridControl.LevelTree.Nodes.Add("Details", mySecondGridView)
   End If
  </code></pre>
  
  <p>What I want to do is generate a report that displays what the user is currently seeing in the gridControl. For example if the user filters or sorts the data or changes the column size or visibility this will be reflected in the report they generate.</p>
  
  <p>Currently to generate the report I added the PrintingSystem, to the designer, and then within the PrintingSystem Links collection I added a PrintableComponentList. The PrintableComponentList.component was set to my gridcontrol. Within my code, when the Print Grid button is pressed, I call:</p>
  
  <pre><code>PrintableComponentLink1.CreateDocument()
  PrintableComponentLink1.ShowPreview()
  </code></pre>
  
  <p>This prints a report that looks good. The columns are represented correctly and if the data is grouped, etc the report reflects this. The issue I have with this is it doesn't show the subgrid, the second gridview, even it I expand all or some of the grid before previewing the report. I even decided to ignore the printing system and instead tried printing right from the gridControl with:</p>
  
  <pre><code>myGridControl.ShowPrintPreview() 
  </code></pre>
  
  <p>but this also showed the first gridView and not the second GridView. </p>
  
  <p>How am I supposed to showcase both the GridViews that the user currently sees within the one GridControl?</p>