13 Answers, 1 is accepted
How are you opening the PDF? Try opening the PDF with Adobe reader.
Princy.
I am experiencing the same issue...
Thanks,
DK
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.
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
'Renew' 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...
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
'Renew' 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...
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.
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.
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
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.
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
Thanks for helping out. Will be waiting for your sample project.
Regards,
Von
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.