Hi all, I want to ask about the report to excel. I want to create a report in excel using telerik following functions as telerik. using "gridlist.MasterTableView.ExportToExcel ()". but I am confused how to make it that I mark it. How to make such a report in excel with telerik??? Please help me master all to make report as picture :D
Thank you
This report image
Thank you
This report image
6 Answers, 1 is accepted
0
Shinu
Top achievements
Rank 2
answered on 13 Jun 2013, 11:07 AM
Hi
I guess you want to have MultiColumn Headers to be exported into Excel.
I have tried an example.Please have a look into the below code.I have attached a screenshot to show the output.
ASPX:
Thanks,
Shinu
I guess you want to have MultiColumn Headers to be exported into Excel.
I have tried an example.Please have a look into the below code.I have attached a screenshot to show the output.
ASPX:
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
ShowGroupPanel
=
"true"
AllowSorting
=
"true"
DataSourceID
=
"SqlDataSource1"
AllowPaging
=
"true"
PageSize
=
"30"
AutoGenerateColumns
=
"false"
>
<
ClientSettings
>
<
Scrolling
AllowScroll
=
"true"
UseStaticHeaders
=
"true"
></
Scrolling
>
</
ClientSettings
>
<
MasterTableView
CommandItemDisplay
=
"Bottom"
>
<
CommandItemSettings
ShowExportToExcelButton
=
"true"
ShowAddNewRecordButton
=
"false"
ShowRefreshButton
=
"false"
/>
<
ColumnGroups
>
<
telerik:GridColumnGroup
HeaderText
=
"Product Details"
Name
=
"ProductDetails"
HeaderStyle-HorizontalAlign
=
"Center"
>
</
telerik:GridColumnGroup
>
<
telerik:GridColumnGroup
HeaderText
=
"Location"
Name
=
"Location"
>
</
telerik:GridColumnGroup
>
<
telerik:GridColumnGroup
HeaderText
=
"Category"
Name
=
"Category"
ParentGroupName
=
"ProductDetails"
>
</
telerik:GridColumnGroup
>
<
telerik:GridColumnGroup
HeaderText
=
"Order Details"
Name
=
"OrderDetails"
ParentGroupName
=
"ProductDetails"
HeaderStyle-HorizontalAlign
=
"Center"
>
</
telerik:GridColumnGroup
>
</
ColumnGroups
>
<
Columns
>
<
telerik:GridBoundColumn
UniqueName
=
"SupplierName"
DataField
=
"SupplierName"
HeaderText
=
"Supplier Name"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
UniqueName
=
"Address"
DataField
=
"Address"
ColumnGroupName
=
"Location"
HeaderText
=
"Address"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
UniqueName
=
"City"
DataField
=
"City"
ColumnGroupName
=
"Location"
HeaderText
=
"City"
>
</
telerik:GridBoundColumn
>
<
telerik:GridNumericColumn
UniqueName
=
"ID"
DataField
=
"ID"
ColumnGroupName
=
"Category"
HeaderText
=
"ID"
>
</
telerik:GridNumericColumn
>
<
telerik:GridBoundColumn
UniqueName
=
"CategoryName"
DataField
=
"CategoryName"
ColumnGroupName
=
"Category"
HeaderText
=
"Name"
>
</
telerik:GridBoundColumn
>
<
telerik:GridNumericColumn
UniqueName
=
"Freight"
DataField
=
"Freight"
ColumnGroupName
=
"OrderDetails"
HeaderText
=
"Freight"
>
</
telerik:GridNumericColumn
>
<
telerik:GridDateTimeColumn
UniqueName
=
"OrderDate"
DataField
=
"OrderDate"
ColumnGroupName
=
"OrderDetails"
HeaderText
=
"Date"
>
</
telerik:GridDateTimeColumn
>
<
telerik:GridBoundColumn
UniqueName
=
"OrderAddress"
DataField
=
"OrderAddress"
ColumnGroupName
=
"OrderDetails"
HeaderText
=
"Address"
>
</
telerik:GridBoundColumn
>
</
Columns
>
</
MasterTableView
>
</
telerik:RadGrid
>
Thanks,
Shinu
0
Kamardy
Top achievements
Rank 1
answered on 14 Jun 2013, 01:34 AM
Thanks Shinu, may I ask again. how to create a report like this see the picture ??? I put a red box
0
Shinu
Top achievements
Rank 2
answered on 14 Jun 2013, 09:17 AM
Hi,
Sorry , i did not understand your requirments well, when you export from radgrid,every content of that will get exported, anything outside of the grid is excluded. Here what is it that you want to add above the table? is it just some header or details of column in radgrid?
Please elaborate on your requirements.
Thanks,
Shinu
Sorry , i did not understand your requirments well, when you export from radgrid,every content of that will get exported, anything outside of the grid is excluded. Here what is it that you want to add above the table? is it just some header or details of column in radgrid?
Please elaborate on your requirements.
Thanks,
Shinu
0
Hi Kamardy,
A possible solution is to use ShiftRowsDown method which gives you the opportunity to insert new rows at the chosen position. More information could be found at the following help article.
Regards,
Kostadin
Telerik
A possible solution is to use ShiftRowsDown method which gives you the opportunity to insert new rows at the chosen position. More information could be found at the following help article.
Regards,
Kostadin
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
RJ
Top achievements
Rank 1
answered on 31 Mar 2016, 06:48 AM
Hello All,
How can I do this multi-column header if my columns are dynamically created?
Lastly why is it I'm having error when I do export text with "-" or "+" character at the beginning of the text. Any workaround?
Thanks in Advance,
RJ
0
Hi,
When the columns are dynamically created you need to hook OnColumnsCreated event handler and set ColumnGroupName to each one of them. Nevertheless, You can either create the column groups declarative or programmatically on Init/Load.
Regards your second question I am not sure which export format you are using but in case you are using Xlsx then you need to set a string format to each cell which start with "-". You can do that by hooking OnInfrastructureExporting and access the cells that starts with "-" and set format to "@".
Regards,
Kostadin
Telerik
When the columns are dynamically created you need to hook OnColumnsCreated event handler and set ColumnGroupName to each one of them. Nevertheless, You can either create the column groups declarative or programmatically on Init/Load.
Regards your second question I am not sure which export format you are using but in case you are using Xlsx then you need to set a string format to each cell which start with "-". You can do that by hooking OnInfrastructureExporting and access the cells that starts with "-" and set format to "@".
Regards,
Kostadin
Telerik
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.