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

exported data mismatch in pdf and excel in radgrid

3 Answers 105 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Partha
Top achievements
Rank 1
Partha asked on 30 Jun 2011, 03:47 PM
i have a radgrid ,inside the the grid i am adding a commanditem template .Inside that commanditemtemplate i am adding three labels above the header .But when i am exporting the grid to pdf ,csv and excel  the commanditemtemplate is appearing in exported excel file only ,but not in pdf and csv.Below is the code i am using:

 <telerik:RadGrid ID="ModifiedContentsReportGrid" runat="server" AutoGenerateColumns="false"
                AllowSorting="true" AllowPaging="true" EnableOutsideScripts="true" PagerStyle-Mode="NextPrevAndNumeric"
                ShowFooter="true"  OnItemCreated="ModifiedContentsReportsGrid_OnItemCreated" Title="Modified Content Report">
                <ExportSettings OpenInNewWindow="true" FileName="Modified Content Report" ExportOnlyData="false">
                    <Pdf PaperSize="A4" AllowPrinting="true" PageBottomMargin="10px" PageTopMargin="25px"
                        PageHeaderMargin="0px" PageLeftMargin="10px" PageRightMargin="10px" PageTitle="Modified Content Report" />
                </ExportSettings>
                <HeaderStyle HorizontalAlign="Center" />
                <ClientSettings>
                    <Scrolling UseStaticHeaders="true" />
                </ClientSettings>
                <MasterTableView Width="100%" CommandItemDisplay="Top"  CommandItemStyle-HorizontalAlign="Right" >
                    <CommandItemTemplate>
                        <table width="100%">
                            <tr align="right">
                                <td>
                                    <asp:Label ID="lblClientName" runat="server" Text="" />
                                </td>
                            </tr>
                            <tr align="right">
                                <td>
                                    <asp:Label ID="lblGenerateDate" runat="server" Text="" />
                                </td>
                            </tr>
                            <tr align="right">
                                <td>
                                    <asp:Label ID="lblDateRange" runat="server" Text="" />
                                </td>
                            </tr>
                        </table>
                    </CommandItemTemplate>


Could anyone provide some solution to this problem??

3 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 05 Jul 2011, 12:38 PM
Hello Partha,

It is possible to export the table in the commanditem template if you follow the guidelines in the PDF export help topic:
PDF export

I'm afraid this content won't make it to the exported file when using the CSV format. If you need to include additional information in the CSV file you can add it on GridExporting event.

Kind 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
Partha
Top achievements
Rank 1
answered on 05 Jul 2011, 12:48 PM
Thanks Daniel for the reply.Can you provide an example? Also we are using the Telerik.Webcontrols namespace and i cannot find the GridExporting event there .can you help?

thanks ,
Partha.
0
Princy
Top achievements
Rank 2
answered on 05 Jul 2011, 01:01 PM
Hello Partha,

There are a few rules that should be followed when exporting HTML tables to PDF:

  • The table should define <colgroup> and <col> elements
  • The number of col elements should be equal to the number of the columns in the table body
  • Width in pixels (or another absolute units) should be set to the table

You can find a working code in the following forum thread.
GridTemplateColumn with <table/> export to PDF

Thanks,
Princy.
Tags
Grid
Asked by
Partha
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Partha
Top achievements
Rank 1
Princy
Top achievements
Rank 2
Share this question
or