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

RadPivotGrid : Export to excel without merging cells

6 Answers 306 Views
PivotGrid
This is a migrated thread and some comments may be shown as answers.
Smash
Top achievements
Rank 1
Smash asked on 22 Jan 2015, 11:34 AM
I am using Radpivotgrid to show some values and using the export function to export the data to Excel. But when exported, the filter data is coming in merged cells. So when i use the filter on this merged column, only 1 row is showing up (with which the filter data is displayed).

How can I export the data to excel with filter values unmerged and copied to all the cells (column)? (providing samples of what I have now and what I am looking for)


I am using Radpivotgrid to show some values and using the export function to export the data to Excel. But when exported, the filter data is coming in merged cells. So when i use the filter on this merged column, only 1 row is showing up (with which the filter data is displayed).

How can I export the data to excel with filter values unmerged and copied to all the cells (column)?

This is how I am getting it now: 

I am using Radpivotgrid to show some values and using the export function to export the data to Excel. But when exported, the filter data is coming in merged cells. So when i use the filter on this merged column, only 1 row is showing up (with which the filter data is displayed).

How can I export the data to excel with filter values unmerged and copied to all the cells (column)?

This is how I am getting it now: 

I am using Radpivotgrid to show some values and using the export function to export the data to Excel. But when exported, the filter data is coming in merged cells. So when i use the filter on this merged column, only 1 row is showing up (with which the filter data is displayed).

How can I export the data to excel with filter values unmerged and copied to all the cells (column)?

This is how I am getting it now: 

6 Answers, 1 is accepted

Sort by
0
Accepted
Maria Ilieva
Telerik team
answered on 27 Jan 2015, 12:39 PM
Hello Smash,

Try using the approach below for achieving the required functionality:

Copy Code
protected void RadPivotGrid1_PivotGridCellExporting(object sender, PivotGridCellExportingArgs e)
    {
        var cell = e.ExportedCell;
        var table = cell.Table;
        if (cell.Rowspan > 1)
        {
            for (int rowOffset = 1; rowOffset < cell.Rowspan; rowOffset++)
            {
                table.Cells[cell.ColIndex, cell.RowIndex + rowOffset].Value = cell.Value;
            }
 
            cell.Rowspan = 1;
        }
       
         
    }

and see if this works for you.

Note that the same approach could be implemented for the Colspan settings.


Regards,
Maria Ilieva
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Smash
Top achievements
Rank 1
answered on 29 Jan 2015, 09:27 AM
Hi Maria, 

many thanks and this perfectly worked for me.
0
Marcelo
Top achievements
Rank 1
answered on 15 May 2015, 02:41 PM

Hello,

In this link  http://demos.telerik.com/aspnet-ajax/pivotgrid/examples/exporting/defaultvb.aspx?show-source=true

 

Protected Sub ButtonExcel_Click(sender As Object, e As EventArgs)            

Dim alternateText As String = TryCast(sender, ImageButton).AlternateText           

 RadPivotGrid1.ExportSettings.Excel.Format = DirectCast([Enum].Parse(GetType(PivotGridExcelFormat), alternateText), PivotGridExcelFormat) 

RadPivotGrid1.ExportSettings.IgnorePaging = CheckBox1.Checked            

RadPivotGrid1.ExportToExcel()        

End Sub

 

I have this error "Excel is not a member of Telerik.Web.UI.PivotGridExportSettings"

0
Maria Ilieva
Telerik team
answered on 19 May 2015, 07:05 AM
Hello Marcelo,

Note that the Excel Export option is available after Q2 2013 release of the PivotGrid control. Please make sure that you are using newer than Q2 2013 version of the control.

Regards,
Maria Ilieva
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
Marcelo
Top achievements
Rank 1
answered on 19 May 2015, 11:02 AM

Hello Maria,

 

Thank you very much for your response.

I fixed this issue commenting this line:

'RadPivotGrid1.ExportSettings.Excel.Format = DirectCast([Enum].Parse(GetType(PivotGridExcelFormat), alternateText), PivotGridExcelFormat) 

 Sometimes, the simpler is the only thing one you need to do.

 

0
Maria Ilieva
Telerik team
answered on 20 May 2015, 01:12 PM
Hello,

This code is actually setting the ExportFormat base on the alternate text of the image buttons using to export in different formats. If you do not need to change the export format you can hardcode it and avoid using this line of code.

Regards,
Maria Ilieva
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
Tags
PivotGrid
Asked by
Smash
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Smash
Top achievements
Rank 1
Marcelo
Top achievements
Rank 1
Share this question
or