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

[Solved] Export to PDF problem

2 Answers 154 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Nejc Žerjal
Top achievements
Rank 1
Nejc Žerjal asked on 20 Nov 2009, 01:42 PM
Hi

I have pdf and excel export on my page. Excel export works great, but with pdf export there is only tabel with no data (attachment).

This are my export settings

<ExportSettings IgnorePaging="true" OpenInNewWindow="true" FileName="XXX" ExportOnlyData="true">
                    <Excel Format="Html" FileExtension="xls" />
                    <Pdf PageHeight="297mm" PageWidth="210mm" />
</ExportSettings>

What am I doing wrong?

Thank you for your help.

2 Answers, 1 is accepted

Sort by
0
Nejc Žerjal
Top achievements
Rank 1
answered on 20 Nov 2009, 02:10 PM
I think i know what the problem might be.

My columns are created this way beacuse i need double header columns
<telerik:GridTemplateColumn>  
     <HeaderTemplate>  
        <table id="Table1" width="100%" border="0">  
           <tr>  
              <td colspan="2" align="center">  
                    text  
              </td>  
        </tr>  
        <tr>  
            <td align="center" style="width: 50%">  
                              text  
            </td>  
            <td align="center" style="width: 50%">  
                                text  
            </td>  
        </tr>  
    </table>  
 </HeaderTemplate>  
 <ItemTemplate>  
    <table id="Table2" width="100%" cellpadding="0" cellspacing="0" border="0">  
        <tr>  
            <td align="right" style="width: 50%;">  
                 <%# Eval("Data")%>  
            </td>  
            <td align="right" style="width: 50%">  
                 <%#  Eval("Data"))%>  
            </td>  
        </tr>  
      </table>  
   </ItemTemplate>  
</telerik:GridTemplateColumn>  
 

But if I create the columns like this
<telerik:GridBoundColumn Resizable="true" DataField="Data" HtmlEncode="true" HeaderText="text" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left"
</telerik:GridBoundColumn> 
everything works fine.

Is there a way i could have double header columns in still have a working pdf export?

Thank you for your help.

0
Accepted
Daniel
Telerik team
answered on 23 Nov 2009, 06:24 PM
Hello Nejc,

Please modify your code this way:
<telerik:GridTemplateColumn>
    <HeaderTemplate>
        <table id="Table1" width="100px" border="0">
            <colgroup>
                <col />
                <col />
            </colgroup>
            <tr>
                <td colspan="2" align="center">
                    HEADER UP
                </td>
            </tr>
            <tr>
                <td align="center" style="width: 50%">
                    H1
                </td>
                <td align="center" style="width: 50%">
                    H2
                </td>
            </tr>
        </table>
    </HeaderTemplate>
    <ItemTemplate>
        <table id="Table2" width="100px" cellpadding="0" cellspacing="0" border="0">
            <colgroup>
                <col />
                <col />
            </colgroup>
            <tr>
                <td align="right" style="width: 50%;">
                    123
                </td>
                <td align="right" style="width: 50%">
                    345
                </td>
            </tr>
        </table>
    </ItemTemplate>
</telerik:GridTemplateColumn>

More information about the PDF format is available in our documentation:
PDF export help topic

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.
Tags
Grid
Asked by
Nejc Žerjal
Top achievements
Rank 1
Answers by
Nejc Žerjal
Top achievements
Rank 1
Daniel
Telerik team
Share this question
or