Using pdfExporter from RadDataGrid View - Wrap Text in pdf how?

1 Answer 79 Views
GridView
Maninder
Top achievements
Rank 1
Maninder asked on 07 Dec 2022, 01:15 PM

I am Using pdfExporter from RadDataGrid View to generate pdf.

How to wrap text of cells/columns      in exported pdf.                using VB.NET not C-Sharp                                                                                                                                                                                                                                                                                                                                                                                                                                        

1 Answer, 1 is accepted

Sort by
0
Dinko | Tech Support Engineer
Telerik team
answered on 07 Dec 2022, 01:37 PM

Hi Maninder,

You can use the CellFormating event of the exporter to set the TextWrap property:

Private Sub PdfExporter_CellFormatting(ByVal sender As Object, ByVal e As PdfExportCellFormattingEventArgs)
    e.CellElement.TextWrap = True
End Sub

I hope this approach will work for you.

Regards,
Dinko | Tech Support Engineer
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Maninder
Top achievements
Rank 1
commented on 07 Dec 2022, 03:35 PM

How to implement your code

 

Private Sub RadButtonElement2_Click(sender As Object, e As EventArgs) Handles RadButtonElement2.Click
        Dim pdfExporter As New Telerik.WinControls.Export.GridViewPdfExport(Me.dgv1)
        pdfExporter.PageSize = New SizeF(356, 216)
        pdfExporter.FitToPageWidth = True
        pdfExporter.ExportVisualSettings = True

             Dim fileName As String = "D:\ExportedData.pdf"
        pdfExporter.RunExport(fileName, New Telerik.WinControls.Export.PdfExportRenderer())
    End Sub

     
Dinko | Tech Support Engineer
Telerik team
commented on 08 Dec 2022, 09:27 AM

You can subscribe to the GridViewPdfExport CellFormatting event. In the event handler, you can set the TextWrap property of the CellElement to True.

Private Sub RadButtonElement2_Click(sender As Object, e As EventArgs) Handles RadButton1.Click
    Dim pdfExporter As New Telerik.WinControls.Export.GridViewPdfExport(Me.RadGridView1)
    pdfExporter.PageSize = New SizeF(356, 216)
    pdfExporter.FitToPageWidth = True
    pdfExporter.ExportVisualSettings = True
    AddHandler pdfExporter.CellFormatting, AddressOf MyCellFormattingHandler

    Dim fileName As String = "C:\temp\ExportedData2.pdf"
    pdfExporter.RunExport(fileName, New Telerik.WinControls.Export.PdfExportRenderer())
End Sub

Private Sub MyCellFormattingHandler(sender As Object, e As PdfExportCellFormattingEventArgs)
    e.CellElement.TextWrap = True
End Sub

Tags
GridView
Asked by
Maninder
Top achievements
Rank 1
Answers by
Dinko | Tech Support Engineer
Telerik team
Share this question
or