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

Radpivotgrid Export problem

8 Answers 306 Views
PivotGrid
This is a migrated thread and some comments may be shown as answers.
Hiram
Top achievements
Rank 1
Hiram asked on 07 May 2015, 10:11 PM

Hi

 Im working with the radpivotgrid, i change some column names in the pivot in the CellDataBound event (like Kostadin explains in this example http://www.telerik.com/forums/edit-grandtotalcolumns-in-radpivotgrid) and works fine, the problem is when i try to export to an Excel file, all the data is exported fine, except the column names that i edited, the column names in the exported excel file dont have the changes i maded, and other thing, there is a way to hide the columns of a PivotGridAggregateField and show only the grand total of this same field?

8 Answers, 1 is accepted

Sort by
0
Kostadin
Telerik team
answered on 12 May 2015, 10:52 AM
Hello Hiram,

I am afraid that the changes are not persisted in the exported file and you have to add them again during the exporting. For this purpose you need to OnPivotGridCellExporting and use almost the same code as the one from the other forum thread. Please check out the following code snippet.
protected void RadPivotGrid1_PivotGridCellExporting(object sender, PivotGridCellExportingArgs e)
{
    if (e.PivotGridCell is PivotGridDataCell)
    {
        PivotGridDataCell cell = e.PivotGridCell as PivotGridDataCell;
        string parentRowIndex = cell.ParentRowIndexes[0].ToString();
        string parentColIndex = cell.ParentColumnIndexes[0].ToString();
        if (parentRowIndex == "Black" && parentColIndex == "Grand Total" && cell.IsGrandTotalCell)
        {
            e.ExportedCell.Value = "New Value";
        }
    }
}

Regards your second question I am afraid you could not hide the PivotGridAggregateField data and show only the grand total value.

Regards,
Kostadin
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
0
Hiram
Top achievements
Rank 1
answered on 12 May 2015, 02:51 PM
Thanks for your quick response, but there is no PivotGridCell property in "e" in that event, only ExportedCell and PivotGridModelCell, and the conversion fails to PivotGridDataCell. I can use the IsGrandTotalCell in the PivotGridModelCell, but i need too the missing ParentRowIndexes property to complete my task.
0
Hiram
Top achievements
Rank 1
answered on 12 May 2015, 02:55 PM
thanks for your response, but i cant find the property PivotGridCell in "e" in this event, only ExportedCell and PivotGridModelCell, i can use the IsGrandTotalCell in the PivotGridModelCell but i really need the ParentColumnIndexes too to complete my task
0
Kostadin
Telerik team
answered on 15 May 2015, 08:48 AM
Hi Hiram,

Note that PivotGridCell object is supported since Q1 2015 version of the controls and in case you are using an older version I would recommend you to upgrade at least to this version.

Regards,
Kostadin
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Ravi Teja
Top achievements
Rank 1
answered on 21 Aug 2018, 12:34 PM

Hi, I am trying to export data from PivotGrid. Below is the code that is used for exporting.

problem now is it is not exporting and screen is just flickering and does not export the data. Could you please help me here.

Thanks in Advance.

 

protected void ExportFile_Click(object sender, EventArgs e)
        {
            
            rpgAging.ExportSettings.Excel.Format = (PivotGridExcelFormat)Enum.Parse(typeof(PivotGridExcelFormat), "Xlsx");
            rpgAging.ExportSettings.IgnorePaging = true;
           // rpgAging.ExportSettings.FileName = String.Format("SAMIDetails-{0:yyyyMMdd-HHmmss}", DateTime.Now);
         
            rpgAging.ExportToExcel();



        }

0
Vessy
Telerik team
answered on 24 Aug 2018, 08:17 AM
Hi Ravi,

The export to Xlsx functionality of RadPivotGrid is based on the Telerik Document Processing libraries - can you, please, verify that they are referenced in your project?
https://docs.telerik.com/devtools/aspnet-ajax/installation/included-assemblies#telerik-document-processing-libraries

Regards,
Vessy
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.

0
naveed
Top achievements
Rank 1
answered on 23 Jul 2019, 12:01 PM
i need to excel export with string value of aggregate field because i have string in radpivotgrid aggregate field.
You can see attached file.

When i export excel of radpivotgrid it is showing aggregate field error error in excel.

kindly tell me solution of this issue.


0
Eyup
Telerik team
answered on 26 Jul 2019, 08:12 AM
Hi Naveed,

You can try these 3 options to achieve this requirement:

1. Set these properties of the field:
<telerik:PivotGridAggregateField ... DataFormatString="{0}">

2. Use the CellDataBound or PreRender event of the PivotGrid to modify the text as value.ToString() before exporting.

3. Use templates:
https://www.telerik.com/support/code-library/export-pivot-grid-with-templates

I hope this will prove helpful.

Regards,
Eyup
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
PivotGrid
Asked by
Hiram
Top achievements
Rank 1
Answers by
Kostadin
Telerik team
Hiram
Top achievements
Rank 1
Ravi Teja
Top achievements
Rank 1
Vessy
Telerik team
naveed
Top achievements
Rank 1
Eyup
Telerik team
Share this question
or