2012-10-07 43 views
0

蔭嘗試我radgrid控件導出爲PDF在電網的同一CSS樣式...
出口radgrid控件與CSS樣式

這裏是我的方法:

<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> 

從代碼behing任何方式或客戶方做吧..

回答

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,您可以在HTMLExporting事件中爲Word和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 

看看this documentation上的Word/Excel導出更多的幫助,併爲this documentation PDF導出幫助。

+0

你讓我錯了...在我的問題代碼ExportSettings沒有一個屬性導出網格與相同的網格CSS ..所以有什麼辦法導入我的網格CSS並將其應用到導出PDF文件文件也.... – Mahmoud

+0

請參閱編輯,爲答案在css出口 – kavun

+0

非常感謝..讚賞 – Mahmoud