Public Class CustomGridViewPdfExport Inherits GridViewPdfExport Public Sub New(ByVal radGridView As Telerik.WinControls.UI.RadGridView) MyBase.New(radGridView) End Sub Protected Overrides Sub DrawHeader() Dim fi As System.Reflection.FieldInfo = GetType(GridViewPdfExport).GetField("editor", System.Reflection.BindingFlags.NonPublic Or System.Reflection.BindingFlags.Instance) Dim editor As PdfEditor = TryCast(fi.GetValue(Me), PdfEditor) If Not Me.ShowHeaderAndFooter Then Return End If editor.SavePosition() editor.CreateMatrixPosition() editor.TranslatePosition(Me.PageSize.Width + 100, Me.PageMargins.Top + 10) editor.SaveProperties() 'specify the font for the first line Me.HeaderFont = New System.Drawing.Font("Calibri", 16.0F, FontStyle.Bold) editor.SetTextFontSize(Me.HeaderFont.Size) editor.TrySetFont(Me.HeaderFont.Name, Me.HeaderFont.Style) 'draw the first line editor.DrawText(" EXPENCE MANAGER REPORT OF (" & MonthName(Date.Today.Month) & "-" & Date.Today.Year & ")") 'editor.TranslatePosition(Me.PageMargins.Left + 440, Me.PageMargins.Top + 15) ''specify the font for the second line 'Me.HeaderFont = New System.Drawing.Font("Calibri", 9.0F, FontStyle.Bold) 'editor.SetTextFontSize(Me.HeaderFont.Size) 'editor.TrySetFont(Me.HeaderFont.Name, Me.HeaderFont.Style) ''editor.DrawTable(New Telerik.Windows.Documents.Fixed.Model.Editing.Tables.Table, New Windows.Size(200, 20)) 'editor.SetFillColor(Color.Blue) ''draw the second line 'editor.DrawText("?=ABSENT,HL=HOLIDAY,S=SUNDAY,H=HALF DAY,F=FULL DAY") editor.RestoreProperties() editor.RestorePosition() End Sub End Class Public Function EXPORTTOPDF() ''HEADER pdfExporter.ShowHeaderAndFooter = True pdfExporter.HeaderHeight = 30 pdfExporter.HeaderFont = New Font("Calibri", 18, FontStyle.Bold) pdfExporter.MiddleHeader = MonthName(Date.Today.Month) & "-" & Date.Today.Year & " EXPENSE MANAGER REPORT" & pdfExporter.MiddleHeader = "Middle header" pdfExporter.SummariesExportOption = SummariesOption.ExportAll ''pdfExporter.Logo = System.Drawing.Image.FromFile("C:\Desert.jpg") ''pdfExporter.LeftHeader = "[Logo]" ''pdfExporter.LogoAlignment = ContentAlignment.TopLeft ''pdfExporter.LogoLayout = Telerik.WinControls.Export.LogoLayout.None pdfExporter.ExportHeaderRowOnEachPage = True 'pdfExporter.ExportSettings.Title = MonthName(RadCalendar1.FocusedDate.Month) & "-" & RadCalendar1.FocusedDate.Year & " " & RadTreeView.SelectedNode.Text & " ATTENDANCE " ''set export settings pdfExporter.RadGridViewToExport.Columns(3).TextAlignment = ContentAlignment.MiddleLeft pdfExporter.ExportVisualSettings = False pdfExporter.ExportHierarchy = True pdfExporter.HiddenColumnOption = HiddenOption.DoNotExport pdfExporter.FitToPageWidth = True pdfExporter.Scale = 0.6F pdfExporter.PageSize = New Size(297, 210) pdfExporter.PageMargins = New Padding(2, 5, 2, 5) Dim fileName As String = My.Computer.FileSystem.SpecialDirectories.Desktop & "\ExpenseManager.pdf" pdfExporter.RunExport(fileName, New Telerik.WinControls.Export.PdfExportRenderer) Process.Start(fileName) End Function