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

Export to Word and Pdf don't work

1 Answer 18 Views
Grid
This is a migrated thread and some comments may be shown as answers.
JP
Top achievements
Rank 1
JP asked on 06 Jun 2012, 09:46 AM
Hi,

I added export to Excel/Word/Pdf to my RadGrid. Export to excel works perfectly, but export to pdf and Word just corrupt my Grid's layout (header and footer aren't displayed anymore). After another postback (e.g. when sorting), the Grid is correctly 
displayed.

These are my settings:
grid.MasterTableView.CommandItemSettings.ShowExportToExcelButton = true;
grid.MasterTableView.CommandItemSettings.ShowExportToPdfButton = true;
grid.MasterTableView.CommandItemSettings.ShowExportToWordButton = true;
grid.ExportSettings.IgnorePaging = true;
grid.ExportSettings.ExportOnlyData = true;
grid.ExportSettings.OpenInNewWindow = true;


I don't have any special logic for excel. This is the only thing I do in the GridItemCommand event handler:

if (e.CommandName == RadGrid.ExportToExcelCommandName ||
   e.CommandName == RadGrid.ExportToPdfCommandName
   || e.CommandName == RadGrid.ExportToWordCommandName)
{
   foreach (GridColumn column in grid.MasterTableView.Columns)
   {
      if (!(column is GridBoundColumn) && !(column is GridCheckBoxColumn))
      {
         column.Visible = false;
      }
   }
}

I don't get any server or client-side errors/warnings when exporting, so what could that be?

1 Answer, 1 is accepted

Sort by
0
JP
Top achievements
Rank 1
answered on 06 Jun 2012, 10:02 AM
I just found the solution. I forgot to handle the ExportToWordButton and ExportToPdfButton in the onRequestStart function.
Tags
Grid
Asked by
JP
Top achievements
Rank 1
Answers by
JP
Top achievements
Rank 1
Share this question
or