我试图将RadGrid导出为pdf(或excel)。我的RadGrid也包含RadHtmlGridCharts。我想以任何格式(图像,图表或其他)以RadGrid导出它们 但我得到的只是一张带有文字而不是图表的表格。
这是ASPX代码:
<telerik:RadGrid ID="RadGrid5" runat="server" AllowPaging="false"
Skin="Default" OnItemDataBound="RadGrid5_ItemDataBound"
OnNeedDataSource="RadGrid5_NeedDataSource" OnItemCreated="RadGrid5_ItemCreated"
OnItemCommand="RadGrid5_ItemCommand">
代码背后:
protected void RadGrid5_ItemCreated(object sender, GridItemEventArgs e)
{
e.Item.Visible = true;
}
public void ConfigureExport(RadGrid sender)
{
sender.ExportSettings.OpenInNewWindow = true;
sender.ExportSettings.FileName = "ExportedData";
}
protected void RadButton_Click(object sender, EventArgs e)
{
ConfigureExport(RadGrid5);
RadGrid5.MasterTableView.ExportToExcel();
}
答案 0 :(得分:0)
RadHtmlChart在客户端上使用JavaScript呈现,因此您无法将其包含在服务器导出中。也许您可以截取渲染页面的截图并使用PhantomJS等工具将其放入PDF或PNG中,否则您可能需要使用渲染图像的旧RadChart。也许这会有助于http://www.telerik.com/support/code-library/convert-grid-and-chart-with-custum-lines-inside-a-grid-to-pdf或此http://www.telerik.com/support/code-library/exporting-radchart-to-pdf