title: Generate dynamic xtrareport
body: <p>I want to generate dynamic <code>XtraReport</code> using DevExpress but for each Employee I want the details of it on new page of same pdf file.</p>
  
  <pre class="lang-vb prettyprint-override"><code>Dim queryString As String = String.Format("SELECT * FROM Test where Status='P' order by EmployeeCode")
  
  Dim adap As SqlDataAdapter
  adap = New SqlDataAdapter(queryString, connectionString)
  Dim rowsCount As Integer = -1
  rowsCount = adap.Fill(ds)
  
  Dim label As New XRLabel()
  label.Width = 500
  label.Font = New System.Drawing.Font("Verdana", 10.0F, FontStyle.Bold)
  PageHeader1.Controls.Add(label)
  
  If rowsCount &gt; 0 Then
      Dim padding As Integer = 5
      Dim tableWidth As Integer = Me.PageWidth - Me.Margins.Left - Me.Margins.Right - padding * 2
  
      Dim dynamicTable As XRTable = XRTable.CreateTable(New Rectangle(padding, 1, tableWidth, 40), 1, 0) ' table column count
  
      dynamicTable.Width = tableWidth
      dynamicTable.Rows.FirstRow.Width = tableWidth
      dynamicTable.Borders = DevExpress.XtraPrinting.BorderSide.None
  
      dynamicTable.BorderWidth = 0
      Dim i As Integer = 0
      dynamicTable.BeginInit()
      For Each dc As DataColumn In ds.Tables(0).Columns
  
          Dim cell As New XRTableCell()
  
          Dim binding As New XRBinding("Text", ds, ds.Tables(0).Columns(i).ColumnName)
          cell.DataBindings.Add(binding)
          cell.CanGrow = False
          cell.CanShrink = True
          cell.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter
          'cell.WidthF = 10
          'cell.Width = 20
          cell.Text = dc.ColumnName
          dynamicTable.Rows.FirstRow.Cells.Add(cell)
          i += 1
      Next dc
  
      dynamicTable.Font = New System.Drawing.Font("Verdana", 8.0F)
      dynamicTable.AdjustSize()
      dynamicTable.EndInit()
      Detail.Controls.Add(dynamicTable)
      'label.Text = String.Format("Data table: {0}", Test)
  
      Me.DataSource = ds
      Me.DataMember = Test
  
  Else
      label.Text = String.Format("There's no data to display or the table doesn't exists")
  End If
  </code></pre>