ExportToPDF exception

13 posts, 2 answers
  1. Adam
    Adam avatar
    28 posts
    Member since:
    Jun 2009

    Posted 14 Aug 2009 Link to this post

    Hi,
    I'm having a similar issue as the one reported here- http://www.telerik.com/community/forums/aspnet-ajax/grid/pdf-exporting-error.aspx

    Essentially you get this exception when using the method-
    System.Xml.XmlException: The '*' character, hexadecimal value 0x2A, cannot be included in a name.

    I did some debugging and found this in the markup:
    <span id="RadGrid1_ctl00_ctl03_ctl01_ChangePageSizeLabel" class="rgPagerLabel">Page size:</span> 
    <div id="RadGrid1_ctl00_ctl03_ctl01_PageSizeComboBox" class="RadComboBox RadComboBox_Default " style="width:46px;display:-moz-inline-stack;display:inline-block;zoom:1;*display:inline;margin-left:-1px;margin-right:-1px;white-space:normal;">  

    The offending character comes after the 'zoom:1' style on the RadComboBox generated for the grids page size selector (it says 'zoom:1;*display:inline;'  notice the *).

    Is this a bug in the RadComboBox or RadGrid or is there some way to remove this style?
  2. Answer
    Daniel
    Admin
    Daniel avatar
    4946 posts

    Posted 17 Aug 2009 Link to this post

    Hello Adam,

    The problem is that RadComboBox uses special CSS approach that is incompatible with the PDF XSLT transformation. The easiest way to sidestep this error is to set ExportOnlyData to true.

    <ExportSettings ExportOnlyData="true" /> 

    Best regards,
    Daniel
    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Adam
    Adam avatar
    28 posts
    Member since:
    Jun 2009

    Posted 17 Aug 2009 Link to this post

    When I set that property, it now gives me this 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) 
      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) 
  5. Daniel
    Admin
    Daniel avatar
    4946 posts

    Posted 18 Aug 2009 Link to this post

    Hello Adam,

    Could you please attach a runnable version (preferably simplified) of your project to a formal support ticket? I would like to debug it locally if possible. Otherwise, if the code is not so lengthy, you can post it here in this thread.

    Best regards,
    Daniel
    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.
  6. Adam
    Adam avatar
    28 posts
    Member since:
    Jun 2009

    Posted 18 Aug 2009 Link to this post

    I've got a trimmed down sample working and I'm sending it to my co-worker so he can open the ticket on his account (the license for the RadControls and support options are linked to his account).
  7. Answer
    Daniel
    Admin
    Daniel avatar
    4946 posts

    Posted 19 Aug 2009 Link to this post

    Hello Adam,

    Thank you for the sample code. I examined it locally and found what's causing the error. Please modify your code this way:

    foreach (GridHeaderItem headeritem in RadGrid1.MasterTableView.GetItems(GridItemType.Header))  
    {  
        headeritem["exCol"].Text = "<a href='javascript: ExpandCollapseAllTables()' id=\"btnEx\">Expand</a>";  
    }  

    Best regards,
    Daniel
    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.
  8. Adam
    Adam avatar
    28 posts
    Member since:
    Jun 2009

    Posted 19 Aug 2009 Link to this post

    Thanks for your help Daniel, the modification seems to work.
  9. Udaya Kumar
    Udaya Kumar avatar
    4 posts
    Member since:
    Aug 2009

    Posted 26 Aug 2009 Link to this post

    Daniel,

    I am facing an issue while exporting the grid as PDF especially one specific grid ,where in the other one its working perfectly.Below is the error System.InvalidCastException : Unable to cast object of type "Telerik.Web.Apoc.Layout.BlockArea' to type 'Telerik.Web.Apoc.Layout.AreaContainer'. I came to know that are some other developers faced the issue and recommended not have width or height attributes in % instead as px,also to set ignorepaging =false ,I tried those as well but still not working. Please help me to get a workaround for this.

    Grid Control Code in Aspx Page

    <telerik:RadGrid ID="RGVForAV" runat="server" AutoGenerateColumns="false" AllowPaging="true"

                      Width="593px" GridLines="None" Font-Names="Arial" Font-Size="13px" ForeColor="#175399"

                      Skin="new" EnableEmbeddedSkins="False" ActiveItemStyle-Wrap="true" PageSize="10"

                      PagerStyle-AlwaysVisible="true" BorderStyle="None" OnNeedDataSource="RGVForAV_NeedDataSource"

                      OnItemCommand="RGVForAV_ItemCommand" OnItemDataBound="RGVForAV_ItemDataBound"

                      OnPdfExporting="RGVForAV_PdfExporting" >

                      <HeaderContextMenu EnableEmbeddedSkins="False">

                      </HeaderContextMenu>

                      <PagerStyle AlwaysVisible="True" PagerTextFormat=" Change page: {4}  {5} item(s) in {1} Page(s)" />

                      <MasterTableView>

                         <RowIndicatorColumn>

                            <HeaderStyle BackColor="#FDF7E9" Width="20px" />

                            <FooterStyle BackColor="#E6EFEA" />

                         </RowIndicatorColumn>

                         <ExpandCollapseColumn>

                            <HeaderStyle Width="20px" />

                         </ExpandCollapseColumn>

                         <Columns>

                            <telerik:GridTemplateColumn HeaderText="Actions" UniqueName="Actions" Resizable="true">

                               <ItemTemplate>

                                  <div style="position: relative; width: 80px; height: 20px;">

                                     <asp:ImageButton ID="imgbtnEdit" runat="server" alt="" CommandArgument='<%#GetGroupDet(Eval("RelationshipGroupID"),Eval("RelationshipGroupName"),Eval("PartyToID")) %>'

                                        Visible='<%#GetAVName(Eval("RelationshipGroupID")) %>' CommandName="Edit" CssClass="mc_adjusterviews_Edit"

                                        Height="16px" ImageUrl="~/_layouts/Images/CoreSystem.LayoutsApp/edit_icon.gif"

                                        Width="16px" />

                                     <div style="position: absolute; left: 40px; width: 16px; height: 16px;">

                                        <asp:ImageButton ID="imgbtnDelete" runat="server" alt="" CommandArgument='<%#GetGroupDet(Eval("RelationshipGroupID"),Eval("RelationshipGroupName"),Eval("PartyToID")) %>'

                                           CommandName="Delete" Height="16px" ImageUrl="~/_layouts/Images/CoreSystem.LayoutsApp/delete_icon.gif"

                                           Width="16px" ConfirmText="Do you want to Delete this Resolution Code ?" UniqueName="Delete"

                                           Visible='<%#GetVal(Eval("DefaultIndicator")) %>' />

                                        <asp:Label ID="lblDel" runat="server" Visible='<%#SetVisible() %>'>

                                        </asp:Label>

                                     </div>

                                     <asp:ImageButton ID="imgbtnEye" runat="server" alt=" " CommandArgument='<%#Eval("RelationshipGroupID") %>'

                                        CommandName="DefaultView" CssClass="mc_adjusterviews_Eye" ImageUrl='<%#GetUrlDefaultView(Eval("DefaultIndicator")) %>' />

                                  </div>

                               </ItemTemplate>

                            </telerik:GridTemplateColumn>

                            <telerik:GridTemplateColumn DataField="RelationshipGroupName" DataType="System.String"

                               HeaderText="Adjuster View" ItemStyle-Wrap="true" UniqueName="RelationshipGroupName">

                               <ItemTemplate>

                                  <asp:LinkButton ID="LinkBtnAV" runat="server" CommandArgument='<%#GetGroupDet(Eval("RelationshipGroupID"),Eval("RelationshipGroupName"),Eval("PartyToID")) %>'

                                     CommandName="GridLink" Font-Names="Arial" Font-Size="11px" ForeColor="#3369A7"

                                     Style="text-decoration: none" Text='<%#Eval("RelationshipGroupName") %>' Visible='<%#GetAVName(Eval("RelationshipGroupID")) %>'

                                     Wrap="true">

                                  </asp:LinkButton>

                                  <asp:Label ID="lblText" runat="server" Text='<%#Eval("RelationshipGroupName") %>'

                                     Style="font-size: 11px; font-family: Arial" Visible='<%#SetVisible() %>'>

                                  </asp:Label>

                               </ItemTemplate>

                               <ItemStyle Wrap="True" />

                            </telerik:GridTemplateColumn>

                            <telerik:GridBoundColumn DataField="CreatedDate" DataFormatString="{0:d}" DataType="System.DateTime"

                               HeaderText="Created on" ItemStyle-Wrap="true" UniqueName="CreatedDate">

                               <ItemStyle Font-Names="Arial" Font-Size="11px" ForeColor="#404040" Wrap="true" />

                            </telerik:GridBoundColumn>

                            <telerik:GridBoundColumn DataField="Adjuster" DataType="System.Int32" HeaderText="Adjusters"

                               ItemStyle-Wrap="true" UniqueName="Adjuster">

                               <ItemStyle Font-Names="Arial" Font-Size="11px" ForeColor="#404040" Wrap="true" />

                            </telerik:GridBoundColumn>

                         </Columns>

                      </MasterTableView>

                      <FilterMenu EnableEmbeddedSkins="False">

                      </FilterMenu>

                      <ActiveItemStyle Wrap="True" />

                      <ExportSettings ExportOnlyData="true" OpenInNewWindow="true" IgnorePaging="true">

                         <Pdf PageTitle="Adjuster Views List" PageWidth="450mm" PaperSize="A4" />

                         <Excel Format="ExcelML" />

                      </ExportSettings>

    </telerik:RadGrid>

    Thanks in advance.

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

  10. Daniel
    Admin
    Daniel avatar
    4946 posts

    Posted 31 Aug 2009 Link to this post

    Hello Udaya,

    There are two reasons for this error in your scenario:
    - DIV element with hardcoded size (width, height)
    - DIV with position: absolute

    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.
  11. Brady
    Brady avatar
    34 posts
    Member since:
    Mar 2009

    Posted 11 Sep 2009 Link to this post

    ExportDataOnly is a bit of a meagre solution if you want to export images.
  12. Daniel
    Admin
    Daniel avatar
    4946 posts

    Posted 11 Sep 2009 Link to this post

    Hello Brady,

    Try one of the following workarounds:
    protected void RadGrid1_PdfExporting(object source, GridPdfExportingArgs e) 
        e.RawHTML = e.RawHTML.Replace("*display""display"); 

    or:
    protected void Button1_Click(object sender, EventArgs e) 
        foreach (GridPagerItem item in RadGrid1.MasterTableView.GetItems(GridItemType.Pager)) 
            item.PagerContentCell.Controls.Clear(); 
        RadGrid1.MasterTableView.ExportToPdf(); 

    Note, that none of these suggestions will affect the actual page but only the PDF file.

    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.
  13. Brady
    Brady avatar
    34 posts
    Member since:
    Mar 2009

    Posted 11 Sep 2009 Link to this post

    Thanks Daniel, but I've come right with a simple solution for now:  a Pager Mode of NumericPages removes all the uglies and all works quite well.
  14. Udaya Kumar
    Udaya Kumar avatar
    4 posts
    Member since:
    Aug 2009

    Posted 28 Sep 2009 Link to this post

    Thanks Daniel,I had sorted out the issue by hiding the header.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017