This example demonstrates how to dynamically create a report based upon the ASPxGridView control at runtime. This means that all filtering, sorting and grouping conditions selected in the grid are also applied in a report. To accomplish this task, it is necessary to create a report with all the necessary bands, bind it to a data source and adjust all the necessary options.You can use this approach if you need to display content of templated columns in your report or insert a report based on ASPxGridView to another report.
See also:
E4755: How to convert and then print an GridView extension by using the XtraReport
Question Comments
Added By: Opus 5K at: 9/12/2013 12:01:12 AM
Dear support. I have been trying for several days now to export custom cell templates of a pivotgrid but with no luck. From my previous posts, I understand that the exporting of pivotgrid custom cells is not supported, nor are there any plans to support this in the future. This is a serious shortfall for us and could mean that we are just not able to use your controls if we are not able get the data out to the users.
I then came across this post which appears to be doing exactly what we need to do, although this is doing it against a ASPXGridView and not against a ASPXPivotGrid.
I have been trying to "translate" the C# code so that it instead works off of the ASPXPivotGrid but have not been able to.
Is there any chance that somebody there could provide the equivalent sample that will take a ASPXPivotGrid and create a report out of it which includes the templated cells? As an ideal example, if you are able to show how this code would work against your own templated example found here: http://demos.devexpress.com/aspxpivotgriddemos/Templates/CellTemplates.aspx
I have seen several posts now where users are requesting the ability to export templated cells from the pivotgrid, so I am sure any assistance/sample code you can provide along the same lines as what you have done here will be very useful for quite a few of us.
Thanks in advance
Added By: Andrew L (DevExpress Support) at: 9/12/2013 3:08:43 AMHello,
To export an ASPxPivotGrid control with custom templates use an approach from : http://www.devexpress.com/Support/Center/CodeCentral/ViewExample.aspx?exampleId=E2686 example.
Added By: Cristiano2s at: 2/4/2014 11:18:30 AMHi,
this example works fine and it was very good to my application. But i need the same to excel, and when i did the changes i lost the header. Do you have the same example or just the part to export to excel?
Added By: Vijay Macha at: 5/29/2014 2:51:45 PMHi,
This example is great. Can we export GridviewBand column also in this approach. we are using devexpress 2014 v1.2
In ReportHelper.vb, in InitDetailsandPageheader cell.Text is set to the FieldName where I think it should really be set to the ColumnCaption to make use of the work done in GetColumnsInfo which selects the ColumnCaption to be the Caption if there is one or FieldName if there isn't. It certainly works better for me. This affects C#, VB and the MVC example code.
cell.Width = columns(i).ColumnWidth
cell.Text = columns(i).ColumnCaption 'Better to show the Caption than the examples columns(i).FieldName
row.Cells.Add(cell