RadPivotGrid : Export to excel without merging cells

7 posts, 1 answers
  1. Smash
    Smash avatar
    3 posts
    Member since:
    Sep 2013

    Posted 22 Jan 2015 Link to this post

    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: 

  2. Answer
    Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 27 Jan 2015 Link to this post

    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.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Smash
    Smash avatar
    3 posts
    Member since:
    Sep 2013

    Posted 29 Jan 2015 in reply to Maria Ilieva Link to this post

    Hi Maria, 

    many thanks and this perfectly worked for me.
  5. Marcelo
    Marcelo avatar
    2 posts
    Member since:
    May 2015

    Posted 15 May 2015 Link to this post

    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"

  6. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 19 May 2015 Link to this post

    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
  7. Marcelo
    Marcelo avatar
    2 posts
    Member since:
    May 2015

    Posted 19 May 2015 in reply to Maria Ilieva Link to this post

    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.

     

  8. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 20 May 2015 Link to this post

    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
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017