RadGrid PDF Export issue

22 posts, 0 answers
  1. Christian Gelman
    Christian  Gelman avatar
    6 posts
    Member since:
    Oct 2009

    Posted 17 May 2010 Link to this post

    Hello!

    I have a RadGrid in my aspNET page where I put 4 export buttons (Excel, Word, PDF and CVS format).

    Everything is working fine with EXCEL, WORD and CVS, but I can not get it work with PDF format.

    It appears the dialog box but I get no data in the resulting pdf, just a "blank" document.

    Is there any difference between the way to export differents formats that I can be missing?

    Its strange for me because not only it is working with other formats, but it is also working with PDF in OTHERS pages we are developing.

    I do not know what it is wrong with this one :-(

    Please let me know and if necessary I could copy a part of my code.

    Thanks!
    Christian
  2. Daniel
    Admin
    Daniel avatar
    4946 posts

    Posted 17 May 2010 Link to this post

    Hello Christian,

    Do you have Scrolling/StaticHeaders enabled? If so, please disable this functionality before exporting to PDF.
    PDF export

    Regards,
    Daniel
    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Christian Gelman
    Christian  Gelman avatar
    6 posts
    Member since:
    Oct 2009

    Posted 18 May 2010 Link to this post

    Hello Daniel,

    I have checked your answer and it worked (setting to "false" both options) but I really need the scroll functionality.

    It is strange because in the same page we have another grid we made before and it is exporting to PDF with "AllowScroll = true" and "UseStaticHeaders = true".  Does it have sense? Because all the grids we have been programming are working and exporting fine with those settings.

    In order to follow your advise but without losing the required functionality, I tried:

    RadGridComparativoPrecios.ClientSettings.Scrolling.AllowScroll = false
                RadGridComparativoPrecios.ClientSettings.Scrolling.UseStaticHeaders = false
                RadGridComparativoPrecios.ExportSettings.FileName = "Grilla-Comparativo-Precios"
                RadGridComparativoPrecios.MasterTableView.ExportToPdf(); 
               RadGridComparativoPrecios.ClientSettings.Scrolling.AllowScroll = true
              RadGridComparativoPrecios.ClientSettings.Scrolling.UseStaticHeaders = true

    But it gives me the following exception:

    System.InvalidCastException: Unable to cast object of type 'Telerik.Web.Apoc.Layout.BlockArea' to type 'Telerik.Web.Apoc.Layout.AreaContainer'.
      at Telerik.Web.Apoc.Fo.Flow.BlockContainer.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)


    I read about that exception and it is about having "div" tags, and I am using them :( But I tried removing...and it keeps failing!!!

    I have attached and image so you can see my Grids.

    Help me please! :(

    My grid Code (it is a Web User Control)

     <telerik:RadGrid ID="RadGridComparativoPrecios" 
              
                 
                Width="450px" 
                 Height="300px" 
                runat="server" 
                OnNeedDataSource="RadGrid1_NeedDataSource" 
                AllowSorting="True" 
                ShowGroupPanel="False" 
                Skin="WebBlue" 
                GridLines="None"  
                AutoGenerateColumns="True"  
                OnColumnCreated="RadGrid1_ColumnCreated" 
                GroupPanel-Text="Arrastre una columna a esta zona para agrupar." 
                OnGroupsChanging="RadGrid1_GroupChanged"  
                OnItemDataBound="Data_OnItemDataBound"  
                AllowFilteringByColumn="true" 
                AllowPaging="True" 
                EnableViewState="true" 
                EnableAJAX="False" 
                OnItemCreated="RadGrid1_ItemCreated" 
                PageSize="50" > 
                 
                <ExportSettings ExportOnlyData="true" IgnorePaging="false" OpenInNewWindow="true" FileName="Grilla-Comparativo-Precio" > 
                <Pdf  Author="Christian" PageTitle="Testing"  /> 
                </ExportSettings> 
     
             <MasterTableView                       
              FilterItemStyle-HorizontalAlign="Center" 
              HeaderStyle-HorizontalAlign="Center" 
               AllowFilteringByColumn="false" 
               AllowMultiColumnSorting="true"  
               EnableHeaderContextMenu="true" 
               CommandItemDisplay="Top" > 
                
                <CommandItemTemplate> 
                    <table width="100%" style="Height:5px;" border="0" cellpadding="2" cellspacing="2"
                        <tr> 
                            
                            <td style="color:#ffffff;">  
                            <asp:label  Width="70px" runat="server" Font-Size="Large" ID="labelCategoria" ></asp:label></td
                             
                             
                            <td> 
                                <asp:ImageButton ID="ExportToExcelButton" runat="server" Text="Exportar a Excel" 
                                    ImageUrl="~/Images/Excel-icon-32.png" Width="23px" Height="23px" ImageAlign="Right" 
                                    OnClick="ExportToExcelButton_Click" /> 
                            </td> 
                            <td> 
                                <asp:ImageButton ID="ExportToWorkButton" runat="server" Text="ExportToWork"  
                                    ImageUrl="~/Images/Word-icon-32.png" Width="23px" Height="23px" ImageAlign="Right" 
                                    OnClick="RadGrid1_GridExportingWord" /> 
                            </td> 
                            <td> 
                                <asp:ImageButton ID="ExportPDFButton" runat="server" Text="ExportToPdf"  
                                    ImageUrl="~/Images/Powerpoint-icon-32.png" Width="23px" Height="23px" ImageAlign="Right" 
                                    OnClick="RadGrid1_GridExportingPdf" /> 
                            </td> 
                            <td> 
                                <asp:ImageButton ID="ExportCvsButton" runat="server" Text="ExportToCvs"  
                                    ImageUrl="~/Images/Visio-icon-32.png" Width="23px" Height="23px" ImageAlign="Right" 
                                    OnClick="RadGrid1_GridExportingCsv" /> 
                            </td> 
                        </tr> 
                    </table> 
               </CommandItemTemplate> 
                      
            </MasterTableView> 
                              
                            <PagerStyle  Visible="false" Position="Bottom" Mode="NextPrevAndNumeric" NextPageToolTip="Siguiente" 
                PrevPageToolTip="Previa" BackColor="#ffffff" Width="100%" PageButtonCount="20"  
                LastPageToolTip="Última Pág." FirstPageToolTip="Primer Pág." 
                PagerTextFormat ="Change page: {4}  Mostrando la página {0}, items desde {2} hasta {3}/Total {5}" AlwaysVisible="true" /> 
           
                            
      
                            <GroupingSettings ShowUnGroupButton="True" 
                            UnGroupButtonTooltip="Click para desagrupar"/> 
                                                
                            <ClientSettings AllowDragToGroup="True" 
                                      AllowColumnsReorder="False" 
                                      AllowKeyboardNavigation="true" >     
                                                                                             
                                                               
                                <Scrolling AllowScroll="true" 
                                           UseStaticHeaders="true" /> 
                                <Resizing AllowColumnResize="True" 
                                          AllowRowResize="True"                                       
                                          EnableRealTimeResize="True"  
                                          ResizeGridOnColumnResize="True"  
                                          ClipCellContentOnResize="True"/> 
                            </ClientSettings>  
                                                
                   
                 </telerik:RadGrid> 
              

    And this is where I use the control...

     <telerik:RadDockLayout runat="server" ID="RadDockLayout1"
            <telerik:RadDockZone ID="RadDockZone1" Runat="server" MinHeight="150px" Width="99%"  BorderWidth="1" FitDocks="true"
                  <telerik:RadDock ID="RadDock7" runat="server" Width="1000px" Skin="Web20" Title="Grilla Comparativo de Precios" Collapsed="true" DockMode="Default" OnClientDragStart="Collapse" 
                    OnClientDragEnd="Expand" BackColor="#CCCCCC" DefaultCommands="ExpandCollapse"
                    <ContentTemplate> 
                    <div style="padding:2px; overflow:hidden;"
                      <table> 
                        <tr> 
                      <td> 
                        <UCGCP:GrillaComparativoPrecios ID="GrillaComparativoPrecios1" runat="server" />  
                        </td> 
                        <td> 
                     <UCGCP:GrillaComparativoPrecios ID="GrillaComparativoPrecios2" runat="server" />  
                     </td> 
                     </tr> 
                        <tr> 
                     <td> 
                       <UCGCP:GrillaComparativoPrecios ID="GrillaComparativoPrecios3" runat="server" />  
                      </td> 
                     <td> 
                      <UCGCP:GrillaComparativoPrecios ID="GrillaComparativoPrecios4" runat="server" /> 
                      </td> 
                      </tr> 
                      </table>  
                      </div> 
                   </ContentTemplate> 
                </telerik:RadDock> 
            </telerik:RadDockZone> 
        </telerik:RadDockLayout> 


    I am also attaching the image of my app:






  5. Daniel
    Admin
    Daniel avatar
    4946 posts

    Posted 19 May 2010 Link to this post

    Hello Christian ,

    You don't have to re-enable the scrolling since this change (and any change you made when exporting) won't affect your page but the exported file only.

    This is all the code you would need
    RadGridComparativoPrecios.ClientSettings.Scrolling.AllowScroll = false;
    RadGridComparativoPrecios.ClientSettings.Scrolling.UseStaticHeaders = false;
    RadGridComparativoPrecios.ExportSettings.FileName = "Grilla-Comparativo-Precios";
    RadGridComparativoPrecios.MasterTableView.ExportToPdf();

    Let me know if other questions arise.

    Regards,
    Daniel
    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.
  6. Andrew
    Andrew avatar
    7 posts
    Member since:
    Jul 2010

    Posted 25 Oct 2010 Link to this post

    Hi,

    I'm trying to export data using radgrid, it works fine for word, csv and excel. But when I try exporting to  dpf document, data is not formatted as it appears on the radgrid and yet for the other formats, are OK. In pdf, the column get resized and come out larger than they appear on the grid and thus they dont fit in A4 page on landscape even when they should.

    How can I ensure the pdf document appear like data displayed on the grid? (i.e. columns in pdf are the same like the fixed columns i have set on radgrid). It works for other formats.

    I have attached two sample docs that I get after exporting data:

    1. Word-All columns appear.jpg: It shows a sample document exported to "word" and all columns are visible and well formatted.
    2. PDF-cut of columns.jpg: Shows a sample document exported to "pdf" only a few columns are visible. The columns widths have been enlarged such that it cannot fit in the A4 page.

    How can I fix this?

  7. Daniel
    Admin
    Daniel avatar
    4946 posts

    Posted 28 Oct 2010 Link to this post

    Hello Andrew,

    There is no point of comparison in this case. The PDF export is limited to the page size unlike the other export formats which can theoretically spread as much as you like (in "view" mode) provided that the number of columns is less than 256.

    Please open your Excel file and choose File -> Print Preview to see what I mean.
     
    Regards,
    Daniel
    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
  8. Justin
    Justin avatar
    7 posts
    Member since:
    Oct 2014

    Posted 31 Oct 2014 in reply to Daniel Link to this post

    I have a similar situation, needing the vertical scroll for display and PDF export on the same grid, but I am using the built-in PDF export button provided by
    <CommandItemSettings ShowExportToPdfButton="true">
    </CommandItemSettings>

    At first I put the code to set ClientSettings.Scrolling properties AllowScroll and UseStaticHeaders to False and rebind in the grid's PdfExporting event handler method, but upon clicking the export button InvalidOperationException is thrown with message "Script controls may not be registered after PreRender."

    Is this technique not compatible with the built-in export to PDF button? Will I have to create my own button and then put those settings and the call to ExportToPdf() in the onClick handler?
  9. Daniel
    Admin
    Daniel avatar
    4946 posts

    Posted 04 Nov 2014 Link to this post

    Hi Justin,

    May I see you code, please? This will help me provide straight to the point answer or solution.
    Looking forward to hearing from you.

    Regards,
    Daniel
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  10. Justin
    Justin avatar
    7 posts
    Member since:
    Oct 2014

    Posted 11 Nov 2014 in reply to Daniel Link to this post

    Thanks, Daniel. Here is the important ASPX: 

    01.<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="reviewProcess.aspx.cs" Inherits="ReviewClass.reviewProcess" MaintainScrollPositionOnPostback="true"  %>
    02. 
    03.<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
    04.<%@ Register Assembly="SD.LLBLGen.Pro.ORMSupportClasses.Web" Namespace="SD.LLBLGen.Pro.ORMSupportClasses" TagPrefix="llblgenpro" %>
    05. 
    06.<!DOCTYPE html>
    07. 
    09.<head runat="server">
    10.    <title>Review Process</title>
    11.    <link href="corporatebasic.css" rel="stylesheet" />
    12.</head>
    13.<body>
    14.    ...
    15.         
    16.            <h3>All Users</h3>
    17.            <telerik:RadButton ID="alternaExportPreflightcheckUsers" runat="server" Text="PDF Export of Scrollable" onclick="alternaExportPreflightcheckUsers_Click"></telerik:RadButton>
    18.            <telerik:RadGrid ID="gridPreflightcheckUsers" runat="server" AutoGenerateColumns="False" DataSourceID="llblgSystemUsers" ToolTip="System Users Overview (Recommend a look at: IsActive not null and SecRoleSummary null)" AllowFilteringByColumn="True" ShowFooter="True" ShowStatusBar="True"  Height="60em"
    19.                OnItemDataBound="gridPreflightcheckUsers_ItemDataBound"
    20.                OnPdfExporting="gridPreflightcheckUsers_PdfExporting"
    21.            >
    22.                <ExportSettings FileName="summary_SystemUsers" OpenInNewWindow="True"  ExportOnlyData="True" Excel-Format="ExcelML" >
    23.                    <Pdf AllowCopy="True" Author="The Company" BorderStyle="Thin" PageTitle="Access Review for System" ForceTextWrap="True" PageBottomMargin="0.5in" PageLeftMargin="0.5in" PageRightMargin="0.5in" PageTopMargin="0.5in" PageHeight="8.5in" PageWidth="11in">
    24.                    </Pdf>
    25.                    <Excel Format="ExcelML" />
    26.                </ExportSettings>
    27.                <ClientSettings>
    28.                    <Scrolling AllowScroll="True" UseStaticHeaders="True"></Scrolling>
    29.                </ClientSettings>
    30.                <MasterTableView DataKeyNames="SystemUserID" DataSourceID="llblgSystemUsers" CommandItemDisplay="Top" >
    31.                    <CommandItemSettings ShowExportToPdfButton="true" ShowExportToExcelButton="false" ShowExportToCsvButton="true" ShowAddNewRecordButton="False" ShowRefreshButton="false">
    32.                    </CommandItemSettings>
    33.                    <RowIndicatorColumn Visible="False">
    34.                    </RowIndicatorColumn>
    35.                    <ExpandCollapseColumn Created="True">
    36.                    </ExpandCollapseColumn>
    37.                    <Columns>
    38.                        <telerik:GridTemplateColumn HeaderText="#" UniqueName="RowNumber" HeaderStyle-Width="3%">
    39.                            <ItemTemplate>
    40.                                <asp:Label runat="server" ID="lblRowNumberAllUsers" Width="50px" Text='<%# Container.DataSetIndex+1 %>'></asp:Label>
    41.                            </ItemTemplate>
    42.                        </telerik:GridTemplateColumn>
    43.                        <telerik:GridBoundColumn DataField="SystemUserID" DataType="System.Int32" FilterControlAltText="Filter SystemUserID column" HeaderText="UID" ReadOnly="True"  SortExpression="SystemUserID" UniqueName="SystemUserID" HeaderStyle-Width="3%">
    44.                        </telerik:GridBoundColumn>
    45.                        <telerik:GridCheckBoxColumn DataField="IsActive" DataType="System.Boolean" FilterControlAltText="Filter IsActive column"  HeaderText="IsActive" SortExpression="IsActive" UniqueName="IsActive" HeaderStyle-Width="3%">
    46.                        </telerik:GridCheckBoxColumn>                     
    47. 
    48.                        <telerik:GridBoundColumn DataField="ADname" FilterControlAltText="Filter ADname column" HeaderText="ADname" SortExpression="ADname" UniqueName="ADname">
    49.                        </telerik:GridBoundColumn>
    50.                        <telerik:GridBoundColumn DataField="FirstName" FilterControlAltText="Filter FirstName column" HeaderText="FirstName" SortExpression="FirstName" UniqueName="FirstName">
    51.                        </telerik:GridBoundColumn>
    52.                        <telerik:GridBoundColumn DataField="LastName" FilterControlAltText="Filter LastName column" HeaderText="LastName" SortExpression="LastName" UniqueName="LastName">
    53.                        </telerik:GridBoundColumn>
    54.                        <telerik:GridBoundColumn DataField="ADuserDetail.Title" FilterControlAltText="Filter Title column" HeaderText="Title" SortExpression="Title" UniqueName="Title">
    55.                        </telerik:GridBoundColumn>
    56.                        <telerik:GridBoundColumn DataField="ADuserDetail.Department" FilterControlAltText="Filter Department column" HeaderText="Department" SortExpression="Department" UniqueName="Department">
    57.                        </telerik:GridBoundColumn>
    58.                        <telerik:GridBoundColumn DataField="ADuserDetail.ManagerDisplayName" FilterControlAltText="Filter Manager Name column" HeaderText="Manager Name" SortExpression="ManagerDisplayName" UniqueName="ManagerDisplayName">
    59.                        </telerik:GridBoundColumn>
    60. 
    61.                        <telerik:GridBoundColumn DataField="SecRoleSummary" FilterControlAltText="Filter SecRoleSummary column" HeaderText="SecRoleSummary" SortExpression="SecRoleSummary" UniqueName="SecRoleSummary" Exportable="true">
    62.                        </telerik:GridBoundColumn>                       
    63.                        <telerik:GridBoundColumn DataField="AFEapprovalLimit" DataType="System.Decimal" DataFormatString="{0:C}" FilterControlAltText="Filter AFEapprovalLimit column" HeaderText="AFEapprovalLimit" SortExpression="AFEapprovalLimit" UniqueName="AFEapprovalLimit">
    64.                        </telerik:GridBoundColumn>
    65.                        <telerik:GridBoundColumn DataField="EmailAddress" FilterControlAltText="Filter EmailAddress column" HeaderText="EmailAddress" SortExpression="EmailAddress" UniqueName="EmailAddress">
    66.                        </telerik:GridBoundColumn>
    67.                    </Columns>
    68.                </MasterTableView>
    69.            </telerik:RadGrid>
    70.            <llblgenpro:LLBLGenProDataSource ID="llblgSystemUsers" runat="server" DataContainerType="EntityCollection" EntityCollectionTypeName="SystemAuditing.CollectionClasses.SystemUserCollection, SystemAuditing" SortingMode="ClientSide">
    71.            </llblgenpro:LLBLGenProDataSource>
    72.            



    And the code behind:

    using System;
    using System.Collections.Generic;
    using System.Collections.Specialized;
    using System.Configuration;
    using System.Data;
    using System.IO;
    using System.Linq;
    using System.Net.Mail;
    using System.Text;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
     
    using SD.LLBLGen.Pro.ORMSupportClasses;
    using SystemAuditing.EntityClasses;
    using SystemAuditing.CollectionClasses;
    using SystemAuditing.HelperClasses;
    using SystemAuditing.FactoryClasses;
    using SystemAuditing.RelationClasses;
     
    using Telerik.Web.UI;
     
    namespace System_Audit_Review_Console
    {      
        public partial class reviewProcess : System.Web.UI.Page
        
            protected void Page_Load(object sender, EventArgs e)
            {      
                SystemUserEntity Suser = new SystemUserEntity(1); //user 1 is Admin
                SystemUserCollection allActiveSystemUsers = new SystemUserCollection();
                 
                //SNIP
                ...
            }
     
            protected void gridPreflightcheckUsers_ItemDataBound(object sender, GridItemEventArgs e)
            {
                if (e.Item is GridDataItem)
                {
                    GridDataItem sysusr = (GridDataItem)e.Item;
                    SystemUserEntity sysusrDetail = new SystemUserEntity(Convert.ToInt32(sysusr["SystemUserID"].Text));
                    sysusr["SecRoleSummary"].Text = sysusrDetail.SecRoleSummary();
                }
            }      
             
            protected void gridPreflightcheckUsers_PdfExporting(object sender, GridPdfExportingArgs e)
            {   //to handle the automatically created in-header export button
                e.RawHTML = "<div style=\"font-weight:bold; font-size:1.25em;\">All System Users    " + DateTime.Now.ToShortDateString() + "</div>" + e.RawHTML;
            }
             
            protected void alternaExportPreflightcheckUsers_Click(object sender, EventArgs e)
            {   //for the separately created export button
                gridPreflightcheckUsers.ClientSettings.Scrolling.AllowScroll = false;
                gridPreflightcheckUsers.ClientSettings.Scrolling.UseStaticHeaders = false;
                gridPreflightcheckUsers.DataBind();
                gridPreflightcheckUsers.MasterTableView.ExportToPdf();
            }
        }
    }

    The automatic header export button creates an almost empty PDF: just the header shows. The "alternative" export radbutton that I put in manually exports successfully. I'd prefer to use the in-header button, though.

    - Justin
  11. Kostadin
    Admin
    Kostadin avatar
    1713 posts

    Posted 14 Nov 2014 Link to this post

    Hello Justin,

    I examined the provided code snippets and I noticed that you are using a simple data binding in your case. Note that we strongly recommend to use advanced data binding through NeedDataSource event as described in the following help article when using the built-in export feature. Please let me know about the result after you made the aforementioned changes.

    Regards,
    Kostadin
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  12. Syan
    Syan avatar
    14 posts
    Member since:
    Feb 2015

    Posted 09 Apr 2015 Link to this post

    While i exporting pdf or word file date column not exported as per radGrid shows? Date column should be right aligned while i exported Word and PDF file.

    how formatted this date column in pdf and word 

    find reference sap-short 

  13. Daniel
    Admin
    Daniel avatar
    4946 posts

    Posted 13 Apr 2015 Link to this post

    Hello Vikas,

    When exporting to Word, it should be enough to set the alignment declaratively this way:
    <telerik:GridBoundColumn ...
        <HeaderStyle HorizontalAlign="Right" />
        <ItemStyle HorizontalAlign="Right" />

    Aligning the header cells in PDF would require a code-behind approach like this:
    protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
    {
        if (e.Item is GridHeaderItem)
            (e.Item as GridHeaderItem)["ColumnUniqueName"].HorizontalAlign = HorizontalAlign.Right;
        else if (e.Item is GridDataItem)
            (e.Item as GridDataItem)["ColumnUniqueName"].HorizontalAlign = HorizontalAlign.Right;
    }

    The latter should work for both Word and PDF.

    Regards,
    Daniel
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  14. Vivek
    Vivek avatar
    2 posts
    Member since:
    Apr 2015

    Posted 14 Apr 2015 Link to this post

    Hi Daniel,

    I am trying to export RadGrid data to word and pdf. The word export is working, but in case of pdf export I am just getting one table with one row and one column and no data in it. Please find the files attached.

    Thanks,
    Vivek

  15. Syan
    Syan avatar
    14 posts
    Member since:
    Feb 2015

    Posted 14 Apr 2015 in reply to Daniel Link to this post

    Thank You It's working now 
  16. soumen
    soumen avatar
    5 posts
    Member since:
    Aug 2015

    Posted 17 Sep 2015 in reply to Christian Gelman Link to this post

    Hello,

     I have a telerik radgrid in which having a column which is containing an image.now when I am trying to export the grid into excel and word format it is working fine.The image is displaying there fine.But when I am trying to export the grid in to pdf format it make me quite frustrated.instead of displaying the image it is displaying image tag string just like ("<td style="font-weight:normal;text-align:left;font-size:9pt;font-family:Arial;vertical-align:top;">2209</td><td style="font-weight:normal;text-align:left;font-size:9pt;font-family:Arial;vertical-align:top;">&lt;img border='0' src= 'http://​root/​abc/GlobalImages/Entity.gif'") alt='Issue' text='Issue' /&gt;</td><td) style="font-weight:normal;text-align:left;font-size:9pt;font-family:Arial;vertical-align:top;">Medium</td>)

    I have set oRadGrid.ExportSettings.ExportOnlyData=false.But I am not getting the proper result. :(

    Please help me to find a good resolution 

    thanx.. 

  17. Daniel
    Admin
    Daniel avatar
    4946 posts

    Posted 21 Sep 2015 Link to this post

    Hello soumen,

    Can you share your grid declaration with us (and eventually code-behind)?

    Regards,
    Daniel
    Telerik
    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 Feedback Portal and vote to affect the priority of the items
  18. RJ
    RJ avatar
    386 posts
    Member since:
    Oct 2006

    Posted 17 Mar in reply to Daniel Link to this post

    Hi All,

    I just want to ask how to change font size for export to pdf. I wanted to make size smaller for I have many columns to show. Also how to change some header text, wanted to abbreviate some of it to save some space.

    Thanks in advance,

    RJ

  19. Kostadin
    Admin
    Kostadin avatar
    1713 posts

    Posted 22 Mar Link to this post

    Hi RJ,

    In order to change the font size you need to loop through the grid cell and apply font-size attribute. You can see how to do that in the following live example. Regards changing the header text you can hoon OnItemDataBound event handler and access the header item. Once you get the header item you can get the its cell by using the column unique name and change the Text property of the cell. More information could be found in the following help article and also in the aforementioned live example.

    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.
  20. RJ
    RJ avatar
    386 posts
    Member since:
    Oct 2006

    Posted 31 Mar in reply to Kostadin Link to this post

    Thank a lot Kostadin!

    Just a follow up question how can I control the position of image in the header? If I set it to GridPdfPageHeaderFooterCell.CellTextAlign.Left, the image will go at the left edge of the page.

    I wanted to have at least 10 to 20 px padding so that it will move a bit but its not working.

    "<img src=""myLogo.jpg"" alt=""Company Logo"" align=""right"" style=""height: 64px; width: auto; padding-left: 10px; "" />

    If I use CellTextAlign.Center, the space from the left edge is to much. Any work around that I can do.

     

    Many thanks,

    RJ

  21. Kostadin
    Admin
    Kostadin avatar
    1713 posts

    Posted 04 Apr Link to this post

    Hi,

    I am afraid you need to access the table cell element and set margin to it in order to move the image. Nevertheless, this cells are rendered after Page_Render event and you cannot access the RadHTML. The
    only possible solution is to use the TextAlign property of the cell.

    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.
  22. Roberto
    Roberto avatar
    13 posts
    Member since:
    Mar 2011

    Posted 04 Apr in reply to RJ Link to this post

    Insert your image in DIV:

     

    "<div style=""margin-left: 50px; ""><img src=""myLogo.jpg"" alt=""Company Logo"" style=""height: 64px;"" /></div>"

  23. RJ
    RJ avatar
    386 posts
    Member since:
    Oct 2006

    Posted 05 Apr in reply to Roberto Link to this post

    Nice! Thanks a lot Roberto!
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017