Hello, I have a wide RadGrid (> 16 cols) that I am trying to export to PDF. When I export to PDF, the grid overflows out of the PDF width. Is there a way to make it use more than 1 page for the width of the table (e.g. 3 pages wide by N pages long)? I want to get something similar to what I get with the RadReport (in another page I am using the RadReport control and it renders the report 3p wide by N pages long). Included is the body of the RadGrid and the code-behind in which I format it. The RadGrid is ajaxified. Thanks for any help you can provide.
Private Sub PDFButton_Click(sender As Object, e As System.EventArgs) Handles PDFButton.Click
_isExport = True
For Each column As Telerik.Web.UI.GridColumn In ReportGrid.MasterTableView.Columns
If column.UniqueName = "SelectCheckbox" Or column.UniqueName = "ViewButton" Then
column.Visible = False
End
If
Next
ReportGrid.Width = New Unit(22)
ReportGrid.MasterTableView.ExportToPdf()
End Sub
Private Sub ReportGrid_ItemCreated(sender As Object, e As Telerik.Web.UI.GridItemEventArgs) Handles ReportGrid.ItemCreated
If _isExport Then
If TypeOf (e.Item) Is GridHeaderItem Then
Dim headerItem As GridHeaderItem = e.Item
headerItem.Style("font-size") = "8pt"
headerItem.Style("color") = "white"
headerItem.Style("background-color") = "gray"
headerItem.Style("vertical-align") = "bottom"
For Each cell As TableCell In headerItem.Cells
cell.Style("text-align") = "left"
cell.Style("font-weight") = "bold"
cell.Style("border-color") = "red"
Next
ElseIf TypeOf (e.Item) Is GridDataItem Then
Dim bodyItem As GridDataItem = e.Item
bodyItem.Style("font-size") = "8pt"
bodyItem.Style("vertical-align") = "bottom"
For Each cell As TableCell In bodyItem.Cells
cell.Style("text-align") = "left"
Next
End If
End If
End Sub
<
telerik:RadGrid
ID
=
"ReportGrid"
runat
=
"server"
Height
=
"99%"
AllowPaging
=
"True"
GridLines
=
"None"
PageSize
=
"50"
AllowSorting
=
"True"
AllowFilteringByColumn
=
"false"
AllowMultiRowSelection
=
"true"
AutoGenerateColumns
=
"false"
>
<
ClientSettings
AllowColumnsReorder
=
"true"
>
<
Scrolling
AllowScroll
=
"true"
UseStaticHeaders
=
"true"
/>
<
Selecting
AllowRowSelect
=
"true"
/>
<
Resizing
AllowColumnResize
=
"true"
AllowResizeToFit
=
"false"
ClipCellContentOnResize
=
"true"
ResizeGridOnColumnResize
=
"true"
EnableRealTimeResize
=
"false"
/>
<
ClientEvents
OnRowDeselected
=
"ReportGrid_OnRowDeselected"
OnRowSelected
=
"ReportGrid_OnRowSelected"
/>
</
ClientSettings
>
<
MasterTableView
>
<
Columns
>
<
telerik:GridClientSelectColumn
UniqueName
=
"SelectCheckbox"
HeaderStyle-Width
=
"30"
/>
<
telerik:GridButtonColumn
DataTextField
=
"FullFileName"
CommandName
=
"View"
ButtonType
=
"ImageButton"
UniqueName
=
"ViewButton"
ImageUrl
=
"/Images/preview.png"
HeaderStyle-Width
=
"30"
/>
<
telerik:GridBoundColumn
DataField
=
"DocArchiveSysKey"
DataType
=
"System.String"
HeaderText
=
"DocArchiveSysKey"
SortExpression
=
"DocArchiveSysKey"
UniqueName
=
"DocArchiveSysKey"
/>
<
telerik:GridBoundColumn
DataField
=
"Division"
DataType
=
"System.String"
HeaderText
=
"Division"
SortExpression
=
"Division"
UniqueName
=
"Division"
/>
<
telerik:GridBoundColumn
DataField
=
"Route"
DataType
=
"System.String"
HeaderText
=
"Route"
SortExpression
=
"Route"
UniqueName
=
"Route"
/>
<
telerik:GridBoundColumn
DataField
=
"Outlet"
DataType
=
"System.String"
HeaderText
=
"Outlet"
SortExpression
=
"Outlet"
UniqueName
=
"Outlet"
/>
<
telerik:GridBoundColumn
DataField
=
"OutletName"
DataType
=
"System.String"
HeaderText
=
"OutletName"
SortExpression
=
"OutletName"
UniqueName
=
"OutletName"
/>
<
telerik:GridBoundColumn
DataField
=
"DocType"
DataType
=
"System.String"
HeaderText
=
"DocType"
SortExpression
=
"DocType"
UniqueName
=
"DocType"
/>
<
telerik:GridBoundColumn
DataField
=
"DisplayDocType"
DataType
=
"System.String"
HeaderText
=
"DisplayDocType"
SortExpression
=
"DisplayDocType"
UniqueName
=
"DisplayDocType"
/>
<
telerik:GridBoundColumn
DataField
=
"DocID"
DataType
=
"System.String"
HeaderText
=
"DocID"
SortExpression
=
"DocID"
UniqueName
=
"DocID"
/>
<
telerik:GridBoundColumn
DataField
=
"DisplayDocDate"
DataType
=
"System.String"
HeaderText
=
"DisplayDocDate Date"
SortExpression
=
"DisplayDocDate"
UniqueName
=
"DisplayDocDate"
/>
<
telerik:GridBoundColumn
DataField
=
"FileName"
DataType
=
"System.String"
HeaderText
=
"FileName"
SortExpression
=
"FileName"
UniqueName
=
"FileName"
/>
<
telerik:GridBoundColumn
DataField
=
"FullFileName"
DataType
=
"System.String"
HeaderText
=
"FullFileName"
SortExpression
=
"FullFileName"
UniqueName
=
"FullFileName"
/>
<
telerik:GridBoundColumn
DataField
=
"DisplaySettlementDate"
DataType
=
"System.DateTime"
HeaderText
=
"DisplaySettlementDate"
SortExpression
=
"DisplaySettlementDate"
UniqueName
=
"DisplaySettlementDate"
/>
<
telerik:GridBoundColumn
DataField
=
"RC2Code"
DataType
=
"System.String"
HeaderText
=
"RC2Code"
SortExpression
=
"RC2Code"
UniqueName
=
"RC2Code"
/>
<
telerik:GridBoundColumn
DataField
=
"RC3Code"
DataType
=
"System.String"
HeaderText
=
"RC3Code"
SortExpression
=
"RC3Code"
UniqueName
=
"RC3Code"
/>
<
telerik:GridBoundColumn
DataField
=
"RC4Code"
DataType
=
"System.String"
HeaderText
=
"RC4Code"
SortExpression
=
"RC4Code"
UniqueName
=
"RC4Code"
/>
<
telerik:GridBoundColumn
DataField
=
"RC5Code"
DataType
=
"System.String"
HeaderText
=
"RC5Code"
SortExpression
=
"RC5Code"
UniqueName
=
"RC5Code"
/>
<
telerik:GridBoundColumn
DataField
=
"EA1Code"
DataType
=
"System.String"
HeaderText
=
"EA1Code"
SortExpression
=
"EA1Code"
UniqueName
=
"EA1Code"
/>
<
telerik:GridBoundColumn
DataField
=
"EA2Code"
DataType
=
"System.String"
HeaderText
=
"EA2Code"
SortExpression
=
"EA2Code"
UniqueName
=
"EA2Code"
/>
<
telerik:GridBoundColumn
DataField
=
"EA3Code"
DataType
=
"System.String"
HeaderText
=
"EA3Code"
SortExpression
=
"EA3Code"
UniqueName
=
"EA3Code"
/>
<
telerik:GridBoundColumn
DataField
=
"EA4Code"
DataType
=
"System.String"
HeaderText
=
"EA4Code"
SortExpression
=
"EA4Code"
UniqueName
=
"EA4Code"
/>
<
telerik:GridBoundColumn
DataField
=
"EA5Code"
DataType
=
"System.String"
HeaderText
=
"EA5Code"
SortExpression
=
"EA5Code"
UniqueName
=
"EA5Code"
/>
<
telerik:GridBoundColumn
DataField
=
"EA6Code"
DataType
=
"System.String"
HeaderText
=
"EA6Code"
SortExpression
=
"EA6Code"
UniqueName
=
"EA6Code"
/>
<
telerik:GridBoundColumn
DataField
=
"EA7Code"
DataType
=
"System.String"
HeaderText
=
"EA7Code"
SortExpression
=
"EA7Code"
UniqueName
=
"EA7Code"
/>
<
telerik:GridBoundColumn
DataField
=
"EA8Code"
DataType
=
"System.String"
HeaderText
=
"EA8Code"
SortExpression
=
"EA8Code"
UniqueName
=
"EA8Code"
/>
<
telerik:GridBoundColumn
DataField
=
"EA9Code"
DataType
=
"System.String"
HeaderText
=
"EA9Code"
SortExpression
=
"EA9Code"
UniqueName
=
"EA9Code"
/>
<
telerik:GridBoundColumn
DataField
=
"EA10Code"
DataType
=
"System.String"
HeaderText
=
"EA10Code"
SortExpression
=
"EA10Code"
UniqueName
=
"EA10Code"
/>
</
Columns
>
</
MasterTableView
>
<
ExportSettings
HideStructureColumns
=
"true"
ExportOnlyData
=
"true"
IgnorePaging
=
"true"
OpenInNewWindow
=
"true"
>
<
Pdf
PageWidth
=
"11in"
PageHeight
=
"8.5in"
PageLeftMargin
=
".5in"
PageRightMargin
=
".5in"
PageTopMargin
=
".5in"
PageBottomMargin
=
".5in"
AllowCopy
=
"true"
AllowModify
=
"true"
AllowPrinting
=
"true"
/>
</
ExportSettings
>
</
telerik:RadGrid
>