Group Panel Printing

3 posts, 0 answers
  1. R.D. Henry and Co.
    R.D. Henry and Co. avatar
    7 posts
    Member since:
    Jun 2013

    Posted 20 Dec 2013 Link to this post

    I have code: 
    RadGridView1.TableElement.GridViewElement.GroupPanelElement.Text = "Some Text"
    RadGridView1.TableElement.GridViewElement.GroupPanelElement.TextAlignment = ContentAlignment.TopLeft

    and I want to print my GroupPanelElement.Text along with my GridView.  Is this possible?  and if so can someone please provide the code to to do this.

    I tried:
      RadGridView1.TableElement.GridViewElement.GroupPanelElement.GridControl.PrintStyle.PrintGrouping = True

    But that doesn't work.

    Thank you in advance,

  2. Dimitar
    Dimitar avatar
    2928 posts

    Posted 23 Dec 2013 Link to this post

    Hello Curtis,

    Thank you for contacting Telerik support. 

    Currently, printing the GroupPanelElement is not supported by RadGridView. Also the PrintGrouping property is used to set whether the group header row will be printed.

    As a suggestion for this case you can manually add this element to the document and print it. To achieve this you can create your own RadPrintDocument associate it with the grid and add the desired element on top of the grid. Please consider the following code snipped:
    Private Sub radButton1_Click(sender As Object, e As EventArgs) Handles RadButton1.Click
        Dim doc As New RadPrintDocument()
        doc.AssociatedObject = Me.RadGridView1
        doc.DefaultPageSettings.Margins = New System.Drawing.Printing.Margins(30, 30, 50, 30)
        AddHandler doc.PrintPage, AddressOf doc_PrintPage
        Dim dialog As New RadPrintPreviewDialog(doc)
    End Sub
    Private Sub doc_PrintPage(sender As Object, e As System.Drawing.Printing.PrintPageEventArgs)
        Dim img As Image = RadGridView1.TableElement.GridViewElement.GroupPanelElement.GetAsBitmapEx(Color.Transparent, 0, New SizeF(1.0F, 1.0F))
        e.Graphics.DrawImage(img, e.MarginBounds.X, e.MarginBounds.Y - 20)
    End Sub

    I hope this information helps. Should you have any other questions, I will be glad to assist you.

    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. R.D. Henry and Co.
    R.D. Henry and Co. avatar
    7 posts
    Member since:
    Jun 2013

    Posted 23 Dec 2013 Link to this post

    Thank you, this worked!
Back to Top