This is a migrated thread and some comments may be shown as answers.

Group Panel Printing

2 Answers 15 Views
GridView
This is a migrated thread and some comments may be shown as answers.
R.D. Henry and Co.
Top achievements
Rank 1
R.D. Henry and Co. asked on 20 Dec 2013, 04:11 PM
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,

Curtis

2 Answers, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 23 Dec 2013, 12:30 PM
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)
    dialog.Show()
 
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.

Regards,
Dimitar
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
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 >>
0
R.D. Henry and Co.
Top achievements
Rank 1
answered on 23 Dec 2013, 02:29 PM
Thank you, this worked!
Tags
GridView
Asked by
R.D. Henry and Co.
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
R.D. Henry and Co.
Top achievements
Rank 1
Share this question
or