4 Answers, 1 is accepted
0
Princy
Top achievements
Rank 2
answered on 30 Sep 2009, 04:23 AM
Hello Stacy,
You can use the Caption property of the ownertableview to add custom heading to the grid while exporting. The section 'Including additional information as part of the exported document' of the following help document should help you achieve this.
Exporting tips and tricks
Thanks
Princy.
You can use the Caption property of the ownertableview to add custom heading to the grid while exporting. The section 'Including additional information as part of the exported document' of the following help document should help you achieve this.
Exporting tips and tricks
Thanks
Princy.
0
Hello Stacy,
Alternatively you can insert the mentioned heading manually in the ExcelMLExportRowCreated. Sample code is shown below:
Regards,
Daniel
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Alternatively you can insert the mentioned heading manually in the ExcelMLExportRowCreated. Sample code is shown below:
| protected void RadGrid1_ExcelMLExportRowCreated(object source, GridExportExcelMLRowCreatedArgs e) |
| { |
| if (e.RowType == GridExportExcelMLRowType.HeaderRow) |
| { |
| RowElement row = new RowElement(); |
| CellElement cell = new CellElement(); |
| cell.MergeAcross = e.Row.Cells.Count - 1; |
| cell.Data.DataItem = "HeaderTest"; |
| row.Cells.Add(cell); |
| e.Worksheet.Table.Rows.Insert(0, row); |
| } |
| } |
Regards,
Daniel
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Stacy
Top achievements
Rank 1
answered on 02 Oct 2009, 08:17 PM
thanks for your responses! Princy, unfortunately the caption doesn't work for me when it is exported in excelML format so that didn't help. Daniel I was able to add the row per your example below but the filters on the individual columns (excel filters) when exported are then applied to this row. What I want is to display a title, centered with the name of the report (aka grid) that the user exported. Many thanks in advance!!!
Stacy Frank
Sundial Software Co
Stacy Frank
Sundial Software Co
0
Accepted
Hello Stacy,
Thank you for the clarification. Please try the following modification:
Let me know if you need further assistance.
Best regards,
Daniel
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Thank you for the clarification. Please try the following modification:
protected void RadGrid1_ExcelMLExportRowCreated(object source, GridExportExcelMLRowCreatedArgs e){ if (e.RowType == GridExportExcelMLRowType.HeaderRow) { RowElement row = new RowElement(); CellElement cell = new CellElement(); cell.MergeAcross = e.Row.Cells.Count - 1; cell.Data.DataItem = RadGrid1.MasterTableView.Caption; cell.StyleValue = "specialStyle"; row.Cells.Add(cell); e.Worksheet.Table.Rows.Insert(0, row); e.Worksheet.AutoFilter.Range = "R2C1:R2C2"; }}protected void RadGrid1_ExcelMLExportStylesCreated(object source, GridExportExcelMLStyleCreatedArgs e){ StyleElement style = new StyleElement(); style.Id = "specialStyle"; style.FontStyle.Bold = true; style.FontStyle.Size = 20; style.AlignmentElement.HorizontalAlignment = HorizontalAlignmentType.Center; e.Styles.Add(style);}Let me know if you need further assistance.
Best regards,
Daniel
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.