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

Export to PDF with RADGrid hireachy

14 Answers 267 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Asra
Top achievements
Rank 1
Asra asked on 02 Jun 2009, 11:29 AM
Hi All,

             Can any onw pls let me know the code that is used to export TO PDF on the RadGrid with the child items.

Regards,
Asra

14 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 02 Jun 2009, 12:15 PM
Hi Asra,

I am sending you a simple runnable application that demonstrates the needed approach. Give it a try and let me know if you have other questions or problems.

Kind regards,
Pavlina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Asra
Top achievements
Rank 1
answered on 02 Jun 2009, 01:23 PM
Hi Pavlina ,

Thnx for sending me the code.

The code is actually not working for me. Iam binding the Grid in the Code-behind.  Iam getting this kind of error:
Telerik.Web.Apoc.ApocException: internal-destination or external-destination must be specified in basic-link
  at Telerik.Web.Apoc.Fo.Flow.BasicLink.Layout(Area area)


Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


Can you pls tell me it is giving me the error.

Regards,
Asra
0
Pavlina
Telerik team
answered on 04 Jun 2009, 05:00 PM
Hi Asra,

I followed your scenario in order to replicate the issue but to no avail.
Please find attached a simple runnable application which demonstrates the needed approach. Give it a try and see if it works for you. 

Best wishes,
Pavlina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Mallikharjun Mulagundla
Top achievements
Rank 1
answered on 12 Dec 2009, 06:39 AM
Hi Paulina,

I have taken your code(Pragrammatic created HierarchyGrid) and Run the application.
-> Don't expnad any row. Once Click on Export to PDF, writing properly into PDF file without any errors
-> Expand any row, Click on Export to PDF, giving floowing error
clicking on the "Export to Excel" 

System.SystemException: At least one of minimum, optimum, or maximum IPD must be specified on table.
  at Telerik.Web.Apoc.ApocDriver.FireApocError(String message)
  at Telerik.Web.Apoc.Fo.Flow.Table.SetIPD(Boolean bHasProportionalUnits, Int32 maxAllocIPD)
  at Telerik.Web.Apoc.Fo.Flow.Table.CalcFixedColumnWidths(Int32 maxAllocationWidth)
  at Telerik.Web.Apoc.Fo.Flow.Table.Layout(Area area)
  at Telerik.Web.Apoc.Fo.Flow.Block.Layout(Area area)
  at Telerik.Web.Apoc.Fo.Flow.TableCell.Layout(Area area)
  at Telerik.Web.Apoc.Fo.Flow.TableRow.Layout(Area area)
  at Telerik.Web.Apoc.Fo.Flow.AbstractTableBody.Layout(Area area)
  at Telerik.Web.Apoc.Fo.Flow.Table.Layout(Area area)
  at Telerik.Web.Apoc.Fo.Flow.Block.Layout(Area area)
  at Telerik.Web.Apoc.Fo.Flow.Flow.Layout(Area area, Region region)
  at Telerik.Web.Apoc.Fo.Flow.Flow.Layout(Area area)
  at Telerik.Web.Apoc.Fo.Pagination.PageSequence.Format(AreaTree areaTree)
  at Telerik.Web.Apoc.StreamRenderer.Render(PageSequence pageSequence)
  at Telerik.Web.Apoc.Fo.FOTreeBuilder.EndElement()
  at Telerik.Web.Apoc.Fo.FOTreeBuilder.Parse(XmlReader reader)


Please help me in resolving this issue.

Thanks
0
Pavlina
Telerik team
answered on 14 Dec 2009, 10:37 AM
Hello Mallikharjun,

I followed you scenario in order to replicate the error but to no avail. Please examine the attached video and let me know if I am leaving something out while testing.

Regards,
Pavlina
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
Heath Corbin
Top achievements
Rank 1
answered on 11 Feb 2010, 11:11 PM
I get the same error as those above when trying to export a radgrid to pdf.  The error I get is "At least one of minimum, optimum, or maximum IPD must be specified on table.".  If you set Internet Explorer to Compatibility Mode, or use Internet Explorer 7, you will get this error too.
0
Heath Corbin
Top achievements
Rank 1
answered on 11 Feb 2010, 11:23 PM
To clarify, the error will not be throw if you are using Chrome, Firefox, or IE 8.  This is only in IE 8 with Compatibility Mode turned on, and IE 7.
0
Pavlina
Telerik team
answered on 15 Feb 2010, 01:29 PM
Hello Heath,

Could you please post your markup here so we can examine it?

Regards,
Pavlina
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Stephen Gray
Top achievements
Rank 1
answered on 12 Mar 2010, 05:15 PM
Hi

I also had this error. I set a width property on the table as shown below and everything worked fine.

<table width="100"
    <colgroup> 
        <col /> 
        <col /> 
    </colgroup>  
    <tr> 
        <td> 
        </td>
        <td>
        </td>
    </tr>
</table>

When I remove this width property again I get the following error.

System.SystemException: At least one of minimum, optimum or maximum IPD must be specified on table.

Is anybody still having this issue ? Anyway setting a width property on the table seems to work although I'd like to know what causes the error. Ill see if i can find more info on the underlying methods.
0
Heath Corbin
Top achievements
Rank 1
answered on 12 Mar 2010, 10:24 PM
Thanks for the suggestion Stephen, however that did not fix the problem for me.

Here is my markup:

 <table width="100">
   <tr>
       <td>
           <p>
           <asp:LinkButton ID="btnExportAllEnrollments" runat="server"  Visible="false" CssClass="button" OnClick="ExportAllEnrollments" />
           </p> 
       </td>
   </tr>
   <tr>
   <td>
       <telerik:radgrid id="RadGrid1" CssClass="RadGrid" Visible="True" skin="Telerik" EnableEmbeddedSkins="false" AutoGenerateColumns="False" runat="server"
               AllowPaging="True" AllowSorting="True" GridLines="none" PagerStyle-Mode="NextPrevAndNumeric"  >
               <ExportSettings OpenInNewWindow="true" ExportOnlyData="true"  IgnorePaging="false" Pdf-AllowPrinting="true"   ></ExportSettings>
               <MasterTableView ShowHeadersWhenNoRecords="False">
               <RowIndicatorColumn UniqueName="RowIndicator" Visible="False">
               <HeaderStyle Width="20px"></HeaderStyle>
               </RowIndicatorColumn>
               <ItemStyle CssClass="RadGridItem" />
               <AlternatingItemStyle CssClass="RadGridAlternatingItem" />
               <HeaderStyle HorizontalAlign="Left" CssClass="RadGridHeader"></HeaderStyle>
               <EditFormSettings>
               <EditColumn UniqueName="EditCommandColumn"></EditColumn>
               </EditFormSettings>
               <ExpandCollapseColumn ButtonType="ImageButton" UniqueName="ExpandColumn" Visible="False">
               <HeaderStyle Width="19px"></HeaderStyle>
               </ExpandCollapseColumn>
               <Columns>
                   <telerik:GridBoundColumn UniqueName="ID" DataField="EnrollmentID" SortExpression="EnrollmentID"
                       AllowSorting="true" Visible="false">
                                   </telerik:GridBoundColumn>
                                  <telerik:GridBoundColumn UniqueName="CourseID" DataField="CourseID" SortExpression="CourseID"
                       AllowSorting="true" Visible="false">
                                  </telerik:GridBoundColumn>                           
                                  <telerik:GridBoundColumn UniqueName="CourseName" HeaderButtonType="TextButton" 
                                       DataField="CourseName" HeaderText="Course Name" SortExpression="CourseName">
                                </telerik:GridBoundColumn>            
           </Columns>
            <DetailTables>
               <telerik:GridTableView DataMember="Enrollment" GridLines="None" Caption="Enrollment Details">
               <PagerStyle Height="20px" Mode="NumericPages" CssClass="GridPager"></PagerStyle>
               <HeaderStyle CssClass="RadGridHeader"></HeaderStyle>
               <ItemStyle CssClass="RadGridItem"  HorizontalAlign="left"></ItemStyle>
               <AlternatingItemStyle CssClass="RadGridAlternatingItem" HorizontalAlign="left"></AlternatingItemStyle>
               <RowIndicatorColumn UniqueName="RowIndicator">
               <HeaderStyle Width="30px"></HeaderStyle>
               </RowIndicatorColumn>
               <Columns>
               <telerik:GridBoundColumn UniqueName="LastAccessDate" HeaderButtonType="TextButton"
                                        DataField="LastAccessDate" HeaderText="Last Access Date" SortExpression="LastAccessDate" DataFormatString="{0:d}">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn UniqueName="EnrollmentTime" HeaderButtonType="TextButton"
                                        DataField="EnrollmentTime" HeaderText="Time in Enrollment" SortExpression="EnrollmentTime">
                                    </telerik:GridBoundColumn>                                    
               </Columns>
               <EditFormSettings>
               <EditColumn UniqueName="EditCommandColumn"></EditColumn>
               </EditFormSettings>
               <ExpandCollapseColumn Visible="False" UniqueName="ExpandColumn">
               <HeaderStyle Width="19px"></HeaderStyle>
               </ExpandCollapseColumn>
               </telerik:GridTableView>
               <telerik:GridTableView DataMember="Assessments"  AllowPaging="false" GridLines="None" Caption="Assessments" >
               <PagerStyle Height="20px" Mode="NumericPages" CssClass="GridPager"></PagerStyle>
               <HeaderStyle CssClass="RadGridHeader"></HeaderStyle>
               <ItemStyle CssClass="RadGridItem"  HorizontalAlign="left"></ItemStyle>
               <AlternatingItemStyle CssClass="RadGridAlternatingItem" HorizontalAlign="left"></AlternatingItemStyle>
               <RowIndicatorColumn UniqueName="RowIndicator">
               <HeaderStyle Width="30px"></HeaderStyle>
               </RowIndicatorColumn>
               <Columns>
                   <telerik:GridTemplateColumn>
                                    <HeaderTemplate>
                                        <asp:LinkButton ID="btnExportTableView1" runat="server" Text="Export" CssClass="button" OnClick="ExportEnrollment" />
                                    </HeaderTemplate>
                                    </telerik:GridTemplateColumn>
               <telerik:GridBoundColumn UniqueName="AssessmentName" HeaderButtonType="TextButton"
                                        DataField="AssessmentName" HeaderText="Assessment Name" SortExpression="AssessmentName">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn UniqueName="LastAttemptStart" HeaderButtonType="TextButton"
                                        DataField="LastAttemptStart" HeaderText="Start Date" SortExpression="LastAttemptStart" >
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn UniqueName="LastAttemptEnd" HeaderButtonType="TextButton"
                                        DataField="LastAttemptEnd" HeaderText="End Date" SortExpression="LastAttemptEnd" >
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn UniqueName="EnrollmentAssessmentStateName" HeaderButtonType="TextButton"
                                        DataField="EnrollmentAssessmentStateName" HeaderText="Status" SortExpression="EnrollmentAssessmentStateName">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridTemplateColumn HeaderText="Grade">
                                        <ItemTemplate>
                                            <%# this.GetGradeDisplay((string)DataBinder.Eval(Container.DataItem, "PercentGradeDisplay"),
                                                                     (int)DataBinder.Eval(Container.DataItem, "EnrollmentAssessmentStateID")) %>
                                        </ItemTemplate>
                                    </telerik:GridTemplateColumn>
                                     <telerik:GridBoundColumn UniqueName="PercentageCompleted" HeaderButtonType="TextButton"
                                        DataField="PercentageCompleted" HeaderText="Course Completion" SortExpression="EnrollmentTime">
                                    </telerik:GridBoundColumn>                                    
               </Columns>
               <EditFormSettings>
               <EditColumn UniqueName="EditCommandColumn"></EditColumn>
               </EditFormSettings>
               <ExpandCollapseColumn Visible="False" UniqueName="ExpandColumn">
               <HeaderStyle Width="19px"></HeaderStyle>
               </ExpandCollapseColumn>
               </telerik:GridTableView>
               </DetailTables>
               </MasterTableView>
               <FilterMenu NotSelectedImageUrl="~/RadControls/Grid/Skins/Default/NotSelectedMenu.gif" HoverBackColor="LightSteelBlue"
               HoverBorderColor="Navy" SelectColumnBackColor="Control" SelectedImageUrl="~/RadControls/Grid/Skins/Default/SelectedMenu.gif"
               TextColumnBackColor="Window"></FilterMenu>
               <GroupHeaderItemStyle CssClass="RadGridAlternatingItem" VerticalAlign="Middle"></GroupHeaderItemStyle>
               <GroupPanel Visible="False">
               <PanelItemsStyle CssClass="GroupPanelItem"></PanelItemsStyle>
               <PanelStyle CssClass="GroupPanel"></PanelStyle>
               </GroupPanel>
                </telerik:radgrid>
   </td>
</tr>
</table>
0
Pavlina
Telerik team
answered on 17 Mar 2010, 04:24 PM
Hi Heath,

In order to avoid this error you should define width to your GridTableViews. An example is shown below:
ASPX:
<MasterTableView ShowHeadersWhenNoRecords="False">            
            <DetailTables>
               <telerik:GridTableView DataMember="Enrollment" GridLines="None" Caption="Enrollment Details" Width="100%">
.......................

I hope this helps.

Best wishes,
Pavlina
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Nicolaï
Top achievements
Rank 2
answered on 28 Apr 2010, 01:51 PM
It did help me..! Width for detailtables and pdf works again! Thanks!
0
Radha
Top achievements
Rank 1
answered on 13 Feb 2013, 09:40 AM

 


Hi Pavlina,
       Here in the below code i'm adding footer to e.rawhtml dynamically that's when it is throwing  like:
Please can anybody help on this.
  System.IndexOutOfRangeException: Index was outside the bounds of the array.
  at Telerik.Web.Apoc.Fo.Flow.TableRow.CellArray.GetNextFreeCell(Int32 colNum)
  at Telerik.Web.Apoc.Fo.Flow.TableRow.InitCellArray()
  at Telerik.Web.Apoc.Fo.Flow.TableRow.Layout(Area area)
  at Telerik.Web.Apoc.Fo.Flow.AbstractTableBody.Layout(Area area)
  at Telerik.Web.Apoc.Fo.Flow.Table.Layout(Area area)
  at Telerik.Web.Apoc.Fo.Flow.Block.Layout(Area area)
  at Telerik.Web.Apoc.Fo.Flow.Flow.Layout(Area area, Region region)
  at Telerik.Web.Apoc.Fo.Flow.Flow.Layout(Area area)
  at Telerik.Web.Apoc.Fo.Pagination.PageSequence.Format(AreaTree areaTree)
  at Telerik.Web.Apoc.StreamRenderer.Render(PageSequence pageSequence)
  at Telerik.Web.Apoc.Fo.FOTreeBuilder.EndElement()
  at Telerik.Web.Apoc.Fo.FOTreeBuilder.Parse(XmlReader reader)


Code  Snippet:
protected
void grdReport_PdfExporting(object source, GridPdfExportingArgs e)

 

{

 

string strfooter =

"<table width='100px'><colgroup><col /><col /></colgroup><tr><td></td><td></td><td></td><td></td><td><span style='font-Names:Verdana;font-weight:bold;'>Branch Totals</span></td><td></td><td></td>" +

 

 

"<td><span style='font-Names:Verdana;font-weight:bold;'>With in</span><br /><span style='font-Names:Verdana;font-weight:bold;'>Branch</span></td>"+

 

 

"<td><span style='font-Names:Verdana;font-weight:bold;'>To Outside</span><br /><span style='font-Names:Verdana;font-weight:bold;'>Branch</span></td></tr><tr>"+

 

 

"<td></td> <td></td><td></td><td></td><td></td><td><span style='font-Names:Verdana;font-weight:bold'>Total -Recruited</span></td>"+

 

 

"<td>"+(recruited.ToString()+"</td><td>"+recruited.ToString()+"</td><td>"+recruited.ToString()+"</td></tr><tr>"+

 

 

"<td></td> <td></td><td></td><td></td><td></td><td><span style='font-Names:Verdana;font-weight:bold;'>Total -Referred</span></td>"+

 

 

"<td>"+(referred.ToString()+" </td><td>"+referred.ToString()+"</td>"+

 

 

"<td>"+referred.ToString()+"</td></tr><tr><td></td> <td></td><td></td><td></td><td></td><td><span style='font-Names:Verdana;font-weight:bold;'>Total -Direct Placement</span></td>"+

 

 

"<td>"+WithinBranch.ToString()+" </td><td>"+WithinBranch.ToString()+" </td><td>"+directToOutside.ToString()+"</td></tr>"+

 

 

"<tr><td># -indicates activity is to an outside branch</td> <td></td><td></td><td></td><td></td><td><span style='font-Names:Verdana;font-weight:bold'>Total Count of New Starts for specified period</span></td>"+

 

 

"<td>"+directWithinBranch.ToString()+" </td><td></td><td></td></tr></table>";

 

e.RawHTML =

"<left><img alt='test' style='height:20px;width:100px;' src='~/images/Volt.jpg'/></left><center style='font-family:Verdana;font-weight:bold'>" + lblReportTitle.Text + "<br />" + "</center>" + e.RawHTML + strfooter;

 

 

}

0
Radha
Top achievements
Rank 1
answered on 14 Feb 2013, 02:03 PM

I found a solution for my earlier post.

Need to Set couple of <col /><col /> for the each <td></td> count in one row. 
For Example:
"<table width='100px'><colgroup><col /><col /><col /><col /><col /><col /><col /><col /><col /><col />
<col /><col /><col /><col /><col /><col /><col /><col /></colgroup><tr><td></td><td></td><td></td><td></td><td><span style='font-Names:Verdana;font-weight:bold;'>Branch Totals</span></td><td></td><td></td>"
+

 

 

"<td><span style='font-Names:Verdana;font-weight:bold;'>With in</span><br /><span style='font-Names:Verdana;font-weight:bold;'>Branch</span></td>"+

 

 

"<td><span style='font-Names:Verdana;font-weight:bold;'>To Outside</span><br /><span style='font-Names:Verdana;font-weight:bold;'>Branch</span></td></tr></table>

In my above example i have 9 pairs of <td>'s ,so i added 9*2 = 18 <col /> then it worked perfectly for me.

Tags
Grid
Asked by
Asra
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Asra
Top achievements
Rank 1
Mallikharjun Mulagundla
Top achievements
Rank 1
Heath Corbin
Top achievements
Rank 1
Stephen Gray
Top achievements
Rank 1
Nicolaï
Top achievements
Rank 2
Radha
Top achievements
Rank 1
Share this question
or