Dhamodharan
Top achievements
Rank 1
Dhamodharan
asked on 21 Apr 2011, 01:22 PM
Hi,
I have radgrid. i am using export to excelML from radgrid. i want give caption or header like "Employee Report 2011-2012". how to get set manually in code behind?
Is there any possible way this one?
Thanks,
Dhamu.
I have radgrid. i am using export to excelML from radgrid. i want give caption or header like "Employee Report 2011-2012". how to get set manually in code behind?
Is there any possible way this one?
Thanks,
Dhamu.
6 Answers, 1 is accepted
0
Shinu
Top achievements
Rank 2
answered on 21 Apr 2011, 02:36 PM
Hello Dhamu,
You can set the Caption property as required to show heading for the exported file.
C#:
Also take a look at the following forum which explains how to set header and footer for exported file.
Export to Excel/Pdf from RadGrid
-Shinu.
You can set the Caption property as required to show heading for the exported file.
C#:
RadGrid1.MasterTableView.Caption =
"Heading"
;
Also take a look at the following forum which explains how to set header and footer for exported file.
Export to Excel/Pdf from RadGrid
-Shinu.
0
Dhamodharan
Top achievements
Rank 1
answered on 21 Apr 2011, 02:53 PM
Hi Shine,
It is not working for me. doesn't any change.
Let me know if any other options?
Thanks,
Dhamu
It is not working for me. doesn't any change.
Let me know if any other options?
Thanks,
Dhamu
0
Accepted
Hello Dhamu,
Try this approach:
Regards,
Daniel
the Telerik team
Try this approach:
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);
e.Worksheet.AutoFilter.Range = e.Worksheet.AutoFilter.Range.Replace(
"R1"
,
"R2"
);
}
}
Regards,
Daniel
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Dhamodharan
Top achievements
Rank 1
answered on 25 Apr 2011, 10:16 AM
Hi Daniel,
Great. it working fine. keep it up.
Thanks,
Dhamu.
Great. it working fine. keep it up.
Thanks,
Dhamu.
0
illumination
Top achievements
Rank 2
answered on 21 Sep 2011, 02:40 PM
I am not using excelML but just regular grid to excel exporting. I tried to add the caption as you directed:
RadGrid1.MasterTableView.Caption =
"Heading"
;
It is working but I need to make it bold and bigger font size.
How do I do that simple way?
Also I need to add a date to the caption heading for example:
Meeting Agenda for: xx/xx/xxxx to xx/xx/xxxx, this xx is from the range date that are located in the page (raddatepickerstartdate and raddatepickerenddate). Is this possible?
Thank you!
0
Dhamodharan
Top achievements
Rank 1
answered on 21 Sep 2011, 04:39 PM
Hello illumination,
Please check with this one and let me know,
Protected Sub gvSummary_ExcelMLExportRowCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridExcelBuilder.GridExportExcelMLRowCreatedArgs) Handles gvSummary.ExcelMLExportRowCreated
If e.RowType = GridExportExcelMLRowType.HeaderRow Then
Dim row As RowElement = New RowElement()
Dim cell As CellElement = New CellElement()
cell.MergeAcross = e.Row.Cells.Count - 1
cell.Data.DataItem = "VETS-100A Detail Report from " & AsofReportFromDate & " To " & AsofReportToDate & " Reporting Time : " & Date.Now.ToString("MM-dd-yyyy H:mm:ss")
cell.StyleValue = "headStyle"
row.Cells.Add(cell)
e.Worksheet.Table.Rows.Insert(0, row)
e.Worksheet.AutoFilter.Range = e.Worksheet.AutoFilter.Range.Replace("R1", "R2")
End If
End sub
Protected Sub gvSummary_ExcelMLExportStylesCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridExcelBuilder.GridExportExcelMLStyleCreatedArgs) Handles gvSummary.ExcelMLExportStylesCreated
Dim headStyle As New StyleElement("headStyle")
headStyle.FontStyle.Bold = True
headStyle.FontStyle.Italic = True
headStyle.AlignmentElement.HorizontalAlignment = GridExcelBuilder.HorizontalAlignmentType.Center
headStyle.InteriorStyle.Pattern = InteriorPatternType.Solid
headStyle.InteriorStyle.Color = Drawing.Color.SkyBlue
e.Styles.Add(headStyle)
End sub
Thanks,
Dhamu.
Please check with this one and let me know,
Protected Sub gvSummary_ExcelMLExportRowCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridExcelBuilder.GridExportExcelMLRowCreatedArgs) Handles gvSummary.ExcelMLExportRowCreated
If e.RowType = GridExportExcelMLRowType.HeaderRow Then
Dim row As RowElement = New RowElement()
Dim cell As CellElement = New CellElement()
cell.MergeAcross = e.Row.Cells.Count - 1
cell.Data.DataItem = "VETS-100A Detail Report from " & AsofReportFromDate & " To " & AsofReportToDate & " Reporting Time : " & Date.Now.ToString("MM-dd-yyyy H:mm:ss")
cell.StyleValue = "headStyle"
row.Cells.Add(cell)
e.Worksheet.Table.Rows.Insert(0, row)
e.Worksheet.AutoFilter.Range = e.Worksheet.AutoFilter.Range.Replace("R1", "R2")
End If
End sub
Protected Sub gvSummary_ExcelMLExportStylesCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridExcelBuilder.GridExportExcelMLStyleCreatedArgs) Handles gvSummary.ExcelMLExportStylesCreated
Dim headStyle As New StyleElement("headStyle")
headStyle.FontStyle.Bold = True
headStyle.FontStyle.Italic = True
headStyle.AlignmentElement.HorizontalAlignment = GridExcelBuilder.HorizontalAlignmentType.Center
headStyle.InteriorStyle.Pattern = InteriorPatternType.Solid
headStyle.InteriorStyle.Color = Drawing.Color.SkyBlue
e.Styles.Add(headStyle)
End sub
Thanks,
Dhamu.