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

Grid foot not exported to Excel (HTML)

3 Answers 75 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Teresia
Top achievements
Rank 1
Teresia asked on 18 Jan 2011, 06:23 PM
Hi

I have a very large report which is divided into 60 pages. I only show the footer on the last page.
If I move to for example page 10 and press export, everything but the footer (aggregate ="sum") will be exported. I always work if I export from the first page.

What have I missed?


Thanks in advance

/Teresia

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 19 Jan 2011, 07:21 AM
Hello Teresia,

I have tried exporting RadGrid data with footer and it shows the footer in exported file. I am using Telerik verion 2010, 3, 1109, 35. Are you using ExcelML as Excel-Format? The footer aggregates are not exported (when using the ExcelML format).

Thanks,
Princy.
0
Teresia
Top achievements
Rank 1
answered on 19 Jan 2011, 12:09 PM

I am using the HTML-export to excel, not ExcelML. Telerik Version 2010.3.1215.35
The footer is exported correctly if I export it from page 1.
I think the problem could be caused by the fact that the footer is only shown on the last page, because if I remove that logic it always work.
I hide/display it in page OnPreRender this way:
GridItem footer = gridView.MasterTableView.GetItems(GridItemType.Footer)[0];
footer.Visible = gridView.MasterTableView.CurrentPageIndex + 1 == gridView.MasterTableView.PageCount;

In GridExporting I have

this.gridView.AllowPaging = false;
this.gridView.ShowFooter = true;
this.gridView.ExportSettings.IgnorePaging = true;
this.gridView.MasterTableView.ExportToExcel();

 

 

 

 

 

 

 

 

 

0
Princy
Top achievements
Rank 2
answered on 20 Jan 2011, 09:20 AM
Hello Teresia,

Set the following conditon in the code and see whether it works now.

C#:
protected void RadGrid1_PreRender(object sender, EventArgs e)
    {
       if (!flag)
        {
            GridItem footer = RadGrid1.MasterTableView.GetItems(GridItemType.Footer)[0];
            footer.Visible = RadGrid1.MasterTableView.CurrentPageIndex + 1 == RadGrid1.MasterTableView.PageCount;
        }
   }
    bool flag = false;
    protected void btnExportBenefits_Click(object sender, EventArgs e)
    {
        flag = true;
        this.RadGrid1.AllowPaging = false;
        this.RadGrid1.ExportSettings.IgnorePaging = true;
        this.RadGrid1.MasterTableView.ExportToExcel();
    }

Thanks,
Princy.
Tags
Grid
Asked by
Teresia
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Teresia
Top achievements
Rank 1
Share this question
or