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

Export to PDF Blank

13 Answers 200 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Donald
Top achievements
Rank 1
Donald asked on 23 May 2008, 06:25 PM
I can export to excel just fine, but when i try to exporttopdf i get a pdf but it is blank.  it only has a header that says "RadGrid export document"

I know this is a simple problem, i am wondering what i am doing wrong?

don

13 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 26 May 2008, 05:04 AM
Hi Donald,

How are you opening the PDF? Try opening the PDF with Adobe reader.

Princy.
0
Dimitris
Top achievements
Rank 1
answered on 19 Aug 2008, 04:00 AM
Has this issue been answered or resolved?

I am experiencing the same issue...

Thanks,

DK
0
Yavor
Telerik team
answered on 19 Aug 2008, 05:08 AM
Hi Dimitris,

Can you please provide a little bit more information on your case? What is the control declaration?

All the best,
Yavor
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Dimitris
Top achievements
Rank 1
answered on 19 Aug 2008, 11:07 AM

Hi Yavor,
Exporting to word works just fine. Its the export to PDF that returns an empty file with only the title populated.
Here is my control implementation:


<

asp:Panel id="pnlMemberItemsOnLoan" runat="server" Visible="False" >

 <div style="float: left;">

 <br />

 <h3><asp:label runat="server" >Items on loan</asp:label></h3>

 </div>

 <div style="float: right;">

 <asp:ImageButton ID="ExportToPdf_ItemsOnLoan" Style="cursor: pointer;" ImageUrl="Images/Pdf.png" AlternateText="Export to PDF" CommandName="ExportToPdf" CommandArgument="gridMemberItemsOnLoan" runat="server" OnCommand="ExportData" Visible="False"></asp:ImageButton>

 <asp:ImageButton ID="ExportToWord_ItemsOnLoan" Style="cursor: pointer;" ImageUrl="Images/word8.png" Width="50px" AlternateText="Export to MS Word" CommandName="ExportToWord" CommandArgument="gridMemberItemsOnLoan" runat="server" OnCommand="ExportData"></asp:ImageButton>

</div>

 <ait:RadGrid runat="server" id="gridMemberItemsOnLoan" Width="963px" Skin="Office2007"

AllowMultiRowSelection="True" AutoGenerateColumns="False"

GridLines="None"

OnExcelMLExportStylesCreated="gridMemberItemsOnLoan_ExcelMLExportStylesCreated"

 

OnExcelMLExportRowCreated="gridMemberItemsOnLoan_ExcelMLExportRowCreated"

 

>

 

<ClientSettings ><%--ClientEvents-OnGridCreated="GetGridObject"--%>

<Selecting AllowRowSelect="True" />

 

<Scrolling AllowScroll="True" UseStaticHeaders="True" />

 

</ClientSettings>

 

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

 

<Excel Format="Html"/>

 

<Pdf AllowAdd="false" AllowCopy="true" AllowModify="true" AllowPrinting="true" Author="Anonymous"

 

Keywords="None" PageBottomMargin="1in" PageLeftMargin="1in" PageRightMargin="1in" PageTopMargin="1in" PageTitle="Items On Loan exported document"

 

Subject="Items On Loan" Title="Items On Loan" PaperSize="A4" />

 

</ExportSettings>

 

<MasterTableView CommandItemDisplay="Top">

 

<RowIndicatorColumn Visible="False">

 

<HeaderStyle Width="20px" />

 

</RowIndicatorColumn>

 

<ExpandCollapseColumn Resizable="False" Visible="False">

 

<HeaderStyle Width="20px" />

 

</ExpandCollapseColumn>

 

<CommandItemTemplate>

 

<div style="padding:5px 0px;">

 

<label id="Label4" runat="server" class="Instruction">

 

Tick on the items you wish to renew and press the

&#39;Renew&#39; button</label>

 

<asp:ImageButton ID="ImageButton1" runat="server" CommandName="RenewOnLoanItems"

CssClass="MemberImageButtons" ImageUrl="Images/ait_blue_vista_Renew.png" OnCommand="DoCommand" />

 

</div>

 

</CommandItemTemplate>

 

<Columns>

 

<ait:GridClientSelectColumn UniqueName="SelectColumn">

 

<HeaderStyle Width="20px" />

 

<ItemStyle Width="20px" />

 

</ait:GridClientSelectColumn>

 

<ait:GridTemplateColumn HeaderText="#" UniqueName="#">

 

<ItemTemplate><%=GetNextID()%></ItemTemplate>

 

<HeaderStyle HorizontalAlign="Center" Width="20px" />

 

<ItemStyle HorizontalAlign="Center" Width="20px" />

 

</ait:GridTemplateColumn>

 

<ait:GridTemplateColumn HeaderText="Date of Loan" UniqueName="ID_LnDate">

 

<ItemTemplate>

 

<%

# DisplayDateIfAfter1960(Eval("ID_LnDate").ToString()) %>

</ItemTemplate>

 

<HeaderStyle Width="70px" />

 

<ItemStyle Width="70px" />

 

</ait:GridTemplateColumn>

 

<ait:GridTemplateColumn HeaderText="Date Due" UniqueName="ID_DueDate">

 

<ItemTemplate>

 

<%

# DisplayDateIfAfter1960(Eval("ID_DueDate").ToString()) %>

</ItemTemplate>

 

<HeaderStyle Width="70px" />

 

<ItemStyle Width="70px" />

 

</ait:GridTemplateColumn>

 

<ait:GridBoundColumn DataField="ID_Item" HeaderText="Barcode" UniqueName="ItemBarcode">

 

<HeaderStyle Width="90px" />

 

<ItemStyle Width="90px" />

 

</ait:GridBoundColumn>

 

<ait:GridTemplateColumn HeaderText="Title" UniqueName="Title">

 

<ItemTemplate>

 

<%

# DisplayTitleAndCaption(Eval("ItemTitle").ToString(), Eval("ItemIssueCaption").ToString()) %>

</ItemTemplate>

 

</ait:GridTemplateColumn>

 

<ait:GridBoundColumn DataField="ItemFormat" HeaderText="Item Format" UniqueName="ItemFormat">

 

<HeaderStyle Width="90px" />

 

<ItemStyle Width="90px" />

 

</ait:GridBoundColumn>

 

<ait:GridBoundColumn DataField="ItemStatusDesc" HeaderText="Status" UniqueName="ItemStatusDesc" Visible="False" />

 

<ait:GridBoundColumn DataField="ItemLentFrom" HeaderText="Loaned From" UniqueName="ItemLentFrom" Visible="False"/>

 

<ait:GridBoundColumn DataField="ItemEstCharge" HeaderText="Estimated Charge" UniqueName="ItemEstCharge" Visible="False"/>

 

<ait:GridBoundColumn DataField="ID_DueDate" HeaderText="ID_DueDateRaw" UniqueName="ID_DueDateRaw" Visible="False"/>

 

<ait:GridBoundColumn DataField="ID_RenSeen" HeaderText="Seen" UniqueName="ID_RenSeen" Visible="False"/>

 

<ait:GridBoundColumn DataField="ID_RenUnseen" HeaderText="Unseen" UniqueName="ID_RenUnseen" Visible="False"/>

 

<ait:GridBoundColumn DataField="ID_AUItem" HeaderText="ID_AUItem" UniqueName="ID_AUItem" Visible="False"/>

 

<ait:GridBoundColumn DataField="ItemTitle" HeaderText="ItemTitle" UniqueName="ItemTitle" Visible="False"/>

 

<ait:GridBoundColumn DataField="ItemIssueCaption" HeaderText="ItemIssueCaption" UniqueName="ItemIssueCaption" Visible="False"/>

 

</Columns>

 

</MasterTableView>

 

</ait:RadGrid>

 

</asp:Panel>



Code Behind:


 

Public

Sub ExportData(ByVal sender As Object, ByVal e As CommandEventArgs)

Try

 

If Not TypeOf (sender) Is ImageButton Then Exit Sub

 

Select Case sender.CommandName

Case "ExportToPdf"

 

gridMemberItemsOnLoan.MasterTableView.ExportToPdf()

Case "ExportToWord"

 

gridMemberItemsOnLoan.MasterTableView.ExportToWord()

End Select

 

Catch ex As Exception

End Try

 

End Sub

 Thanks for looking into this...

0
Dimitris
Top achievements
Rank 1
answered on 19 Aug 2008, 11:07 AM

Hi Yavor,
Exporting to word works just fine. Its the export to PDF that returns an empty file with only the title populated.
Here is my control implementation:


<

asp:Panel id="pnlMemberItemsOnLoan" runat="server" Visible="False" >

 <div style="float: left;">

 <br />

 <h3><asp:label runat="server" >Items on loan</asp:label></h3>

 </div>

 <div style="float: right;">

 <asp:ImageButton ID="ExportToPdf_ItemsOnLoan" Style="cursor: pointer;" ImageUrl="Images/Pdf.png" AlternateText="Export to PDF" CommandName="ExportToPdf" CommandArgument="gridMemberItemsOnLoan" runat="server" OnCommand="ExportData" Visible="False"></asp:ImageButton>

 <asp:ImageButton ID="ExportToWord_ItemsOnLoan" Style="cursor: pointer;" ImageUrl="Images/word8.png" Width="50px" AlternateText="Export to MS Word" CommandName="ExportToWord" CommandArgument="gridMemberItemsOnLoan" runat="server" OnCommand="ExportData"></asp:ImageButton>

</div>

 <ait:RadGrid runat="server" id="gridMemberItemsOnLoan" Width="963px" Skin="Office2007"

AllowMultiRowSelection="True" AutoGenerateColumns="False"

GridLines="None"

OnExcelMLExportStylesCreated="gridMemberItemsOnLoan_ExcelMLExportStylesCreated"

 

OnExcelMLExportRowCreated="gridMemberItemsOnLoan_ExcelMLExportRowCreated"

 

>

 

<ClientSettings ><%--ClientEvents-OnGridCreated="GetGridObject"--%>

<Selecting AllowRowSelect="True" />

 

<Scrolling AllowScroll="True" UseStaticHeaders="True" />

 

</ClientSettings>

 

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

 

<Excel Format="Html"/>

 

<Pdf AllowAdd="false" AllowCopy="true" AllowModify="true" AllowPrinting="true" Author="Anonymous"

 

Keywords="None" PageBottomMargin="1in" PageLeftMargin="1in" PageRightMargin="1in" PageTopMargin="1in" PageTitle="Items On Loan exported document"

 

Subject="Items On Loan" Title="Items On Loan" PaperSize="A4" />

 

</ExportSettings>

 

<MasterTableView CommandItemDisplay="Top">

 

<RowIndicatorColumn Visible="False">

 

<HeaderStyle Width="20px" />

 

</RowIndicatorColumn>

 

<ExpandCollapseColumn Resizable="False" Visible="False">

 

<HeaderStyle Width="20px" />

 

</ExpandCollapseColumn>

 

<CommandItemTemplate>

 

<div style="padding:5px 0px;">

 

<label id="Label4" runat="server" class="Instruction">

 

Tick on the items you wish to renew and press the

&#39;Renew&#39; button</label>

 

<asp:ImageButton ID="ImageButton1" runat="server" CommandName="RenewOnLoanItems"

CssClass="MemberImageButtons" ImageUrl="Images/ait_blue_vista_Renew.png" OnCommand="DoCommand" />

 

</div>

 

</CommandItemTemplate>

 

<Columns>

 

<ait:GridClientSelectColumn UniqueName="SelectColumn">

 

<HeaderStyle Width="20px" />

 

<ItemStyle Width="20px" />

 

</ait:GridClientSelectColumn>

 

<ait:GridTemplateColumn HeaderText="#" UniqueName="#">

 

<ItemTemplate><%=GetNextID()%></ItemTemplate>

 

<HeaderStyle HorizontalAlign="Center" Width="20px" />

 

<ItemStyle HorizontalAlign="Center" Width="20px" />

 

</ait:GridTemplateColumn>

 

<ait:GridTemplateColumn HeaderText="Date of Loan" UniqueName="ID_LnDate">

 

<ItemTemplate>

 

<%

# DisplayDateIfAfter1960(Eval("ID_LnDate").ToString()) %>

</ItemTemplate>

 

<HeaderStyle Width="70px" />

 

<ItemStyle Width="70px" />

 

</ait:GridTemplateColumn>

 

<ait:GridTemplateColumn HeaderText="Date Due" UniqueName="ID_DueDate">

 

<ItemTemplate>

 

<%

# DisplayDateIfAfter1960(Eval("ID_DueDate").ToString()) %>

</ItemTemplate>

 

<HeaderStyle Width="70px" />

 

<ItemStyle Width="70px" />

 

</ait:GridTemplateColumn>

 

<ait:GridBoundColumn DataField="ID_Item" HeaderText="Barcode" UniqueName="ItemBarcode">

 

<HeaderStyle Width="90px" />

 

<ItemStyle Width="90px" />

 

</ait:GridBoundColumn>

 

<ait:GridTemplateColumn HeaderText="Title" UniqueName="Title">

 

<ItemTemplate>

 

<%

# DisplayTitleAndCaption(Eval("ItemTitle").ToString(), Eval("ItemIssueCaption").ToString()) %>

</ItemTemplate>

 

</ait:GridTemplateColumn>

 

<ait:GridBoundColumn DataField="ItemFormat" HeaderText="Item Format" UniqueName="ItemFormat">

 

<HeaderStyle Width="90px" />

 

<ItemStyle Width="90px" />

 

</ait:GridBoundColumn>

 

<ait:GridBoundColumn DataField="ItemStatusDesc" HeaderText="Status" UniqueName="ItemStatusDesc" Visible="False" />

 

<ait:GridBoundColumn DataField="ItemLentFrom" HeaderText="Loaned From" UniqueName="ItemLentFrom" Visible="False"/>

 

<ait:GridBoundColumn DataField="ItemEstCharge" HeaderText="Estimated Charge" UniqueName="ItemEstCharge" Visible="False"/>

 

<ait:GridBoundColumn DataField="ID_DueDate" HeaderText="ID_DueDateRaw" UniqueName="ID_DueDateRaw" Visible="False"/>

 

<ait:GridBoundColumn DataField="ID_RenSeen" HeaderText="Seen" UniqueName="ID_RenSeen" Visible="False"/>

 

<ait:GridBoundColumn DataField="ID_RenUnseen" HeaderText="Unseen" UniqueName="ID_RenUnseen" Visible="False"/>

 

<ait:GridBoundColumn DataField="ID_AUItem" HeaderText="ID_AUItem" UniqueName="ID_AUItem" Visible="False"/>

 

<ait:GridBoundColumn DataField="ItemTitle" HeaderText="ItemTitle" UniqueName="ItemTitle" Visible="False"/>

 

<ait:GridBoundColumn DataField="ItemIssueCaption" HeaderText="ItemIssueCaption" UniqueName="ItemIssueCaption" Visible="False"/>

 

</Columns>

 

</MasterTableView>

 

</ait:RadGrid>

 

</asp:Panel>



Code Behind:


 

Public

Sub ExportData(ByVal sender As Object, ByVal e As CommandEventArgs)

Try

 

If Not TypeOf (sender) Is ImageButton Then Exit Sub

 

Select Case sender.CommandName

Case "ExportToPdf"

 

gridMemberItemsOnLoan.MasterTableView.ExportToPdf()

Case "ExportToWord"

 

gridMemberItemsOnLoan.MasterTableView.ExportToWord()

End Select

 

Catch ex As Exception

End Try

 

End Sub

 Thanks for looking into this...

0
Yavor
Telerik team
answered on 25 Aug 2008, 05:15 AM
Hello Dimitris,

I reviewed the code and it looks correct. However, if the issue persists at your end, you can open a formal support ticket, and send me a small working project, demonstrating the issue. I will debug it locally, and get back to you with my findings.

Kind regards,
Yavor
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Von Aerich
Top achievements
Rank 1
answered on 12 Sep 2008, 07:30 AM
Is this problem solved? I have also encountered this problem.
0
Yavor
Telerik team
answered on 12 Sep 2008, 10:25 AM
Hello Von Aerich,

No further details were provided on the problem in a support ticket. If the issue persists at your end, you can open a formal support ticket, and furnish the relevant details, which would allow us to look into the problem in greater details.

All the best,
Yavor
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Dimitris
Top achievements
Rank 1
answered on 15 Sep 2008, 02:52 PM
Dear Yavor and Von Aerich,
I worked this problem out and I created a simple but nice working example that demonstrates how to export a grid to a pdf file.
 
However, I am not sure how can I upload it as I can't see the attach file icon.
Maybe I have to enter it in the library code(?).

Can someone advice how do I upload an example project in this forum thread?
DK
0
Daniel
Telerik team
answered on 15 Sep 2008, 03:21 PM
Hello Dimitris,

You can add your project to a regular support ticket.

I attached some screenshots illustrating the needed steps.

Regards,
Daniel
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Dimitris
Top achievements
Rank 1
answered on 15 Sep 2008, 11:36 PM
Hi Daniel,
Thank you for your reply.

I didn't specify clearly that I was wondering how can I attach my sample project in this actual forum thread as it will be the most relevant.

I guess we are only allowed to upload samples in the formal support tickets section and then if needed we could link this forum with the support ticket...

Anyway its not a big deal... I only thought to quickly add some files for the viewers of this thread. I will upload it the proper way...

Dimitris
0
Von Aerich
Top achievements
Rank 1
answered on 16 Sep 2008, 02:31 AM
Hi Dimitris,
Thanks for helping out. Will be waiting for your sample project.

Regards,
Von

0
Daniel
Telerik team
answered on 17 Sep 2008, 03:16 PM
Hello,

You can find Dimitris's project (written in VB) attached to this thread.

Alternatively you can try our online demo:
PDF Export Demo

Regards,
Daniel
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Donald
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Dimitris
Top achievements
Rank 1
Yavor
Telerik team
Von Aerich
Top achievements
Rank 1
Daniel
Telerik team
Share this question
or