0

我正在尝试以与网格相同的 CSS 样式将我的 RadGrid 导出为 Pdf...

这是我的方法:

<ExportSettings IgnorePaging="true" OpenInNewWindow="true">
   <Pdf PageHeight="162mm" PageWidth="600mm" PageTitle="Payment Orders" DefaultFontFamily="Arial Unicode MS" Title="Payment Orders"
                PageBottomMargin="50mm" PageTopMargin="35mm" PageLeftMargin="150mm" PageRightMargin="50mm" Author="AbdanSoftware" PaperSize="A4" />
</ExportSettings>

代码行为或客户端的任何方式都可以做到这一点..

4

1 回答 1

2

您可以像这样为您的 RadGrid 设置导出设置:

RadGrid1.ExportSettings.FileName = "File Name"
RadGrid1.ExportSettings.ExportOnlyData = True
RadGrid1.ExportSettings.IgnorePaging = True
RadGrid1.ExportSettings.OpenInNewWindow = True
RadGrid1.ExportSettings.Pdf.PageHeight="162mm"
RadGrid1.ExportSettings.Pdf.PageWidth="600mm"
RadGrid1.ExportSettings.Pdf.PageTitle="Payment Orders"
RadGrid1.ExportSettings.Pdf.DefaultFontFamily="Arial Unicode MS"
RadGrid1.ExportSettings.Pdf.Title="Payment Orders"
RadGrid1.ExportSettings.Pdf.PageBottomMargin="50mm"
RadGrid1.ExportSettings.Pdf.PageTopMargin="35mm"
RadGrid1.ExportSettings.Pdf.PageLeftMargin="150mm"
RadGrid1.ExportSettings.Pdf.PageRightMargin="50mm"
RadGrid1.ExportSettings.Pdf.Author="AbdanSoftware"
RadGrid1.ExportSettings.Pdf.PaperSize="A4"

编辑:要在导出中包含 css,您可以在HTMLExportingWord 和 Excel 格式的事件中这样做。对于 PDF 导出,仅应用内联样式

Private Sub RadGrid1_HTMLExporting(sender As Object, e As Telerik.Web.UI.GridHTMLExportingEventArgs) Handles RadGrid1.HTMLExporting
    Dim css As String = "body { color: red; }"
    e.Styles.Append(css)
End Sub

查看此文档以获取有关 Word/Excel 导出的更多帮助,以及此文档以获取 PDF 导出帮助。

于 2012-10-09T18:21:13.253 回答