How to break the lines in PDF Export from RadGrid

4 posts, 0 answers
  1. Radha
    Radha avatar
    19 posts
    Member since:
    Dec 2012

    Posted 11 Dec 2012 Link to this post

    Please somebody help me how to break the lines and how to give space between words in PDF while exporting from Radgrid.
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 11 Dec 2012 Link to this post

    Hi,

    Try the following code to achieve your scenario.
    C#:
    protected void RadGrid1_PdfExporting(object sender, Telerik.Web.UI.GridPdfExportingArgs e)
       {
           e.RawHTML = e.RawHTML.Replace("<br/>", Environment.NewLine);
       }

    Thanks,
    Shinu.
  3. Radha
    Radha avatar
    19 posts
    Member since:
    Dec 2012

    Posted 12 Dec 2012 Link to this post

    Hi,

    Thanks for the reply but it didn't work.

    Below is the code where e.RawHTML have <br/> tags and those tags are not able to read while exporting to PDF.
    AS you suggested i tried the code but still the issue exists.

     

     

    protected void grdReport_PdfExporting(object source, GridPdfExportingArgs e)

     {

    e.RawHTML = "<left><img alt='test' style='height:20px;width:100px;' src='~/images/Volt.jpg'/></left><center style='font-family:Verdana;font-weight:bold'>" + exportPageTitle + "</center>" + e.RawHTML;

      

    e.RawHTML = e.RawHTML.Replace("<br/>", Environment.NewLine);

    }

    Please help me how to solve the issue?

  4. Kostadin
    Admin
    Kostadin avatar
    1733 posts

    Posted 17 Dec 2012 Link to this post

    Hello Radha,

    If you want to add a new row you have to add a <br/> tag. On the other hand if you want to add an empty space you have to add a &nbsp;. I prepared a small sample and attached it to this forum post. In the example I demonstrated how you can add a new row and empty spaces at the RawHTML.

    Regards,
    Kostadin
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top