No padding when printing cells with HTMLRendering

3 posts, 1 answers
  1. Andreas Haeusler
    Andreas Haeusler avatar
    25 posts
    Member since:
    Nov 2009

    Posted 24 May Link to this post

    Hello,

     

    if I print cells with HTMLRendering the text aligns to the top left of the cell and something equivalent to padding 0;0;0;0 is used. How do you fix that?

     

    private void BestFitRadGridView_PrintCellFormatting(object sender, PrintCellFormattingEventArgs e)
           {
               e.PrintCell.Font = new Font(e.PrintCell.Font.FontFamily, 7F);
               e.PrintCell.EnableHtmlTextRendering = !e.Column.DisableHTMLRendering;
               e.PrintCell.TextPadding = new Padding(5);
             
           }

    If i set EnableHtmlTextRendering = false the padding (set in the printstyle or on cell-level) is used as expected.

     

     

    Kind regards,

    Andreas

  2. Answer
    Hristo Merdjanov
    Admin
    Hristo Merdjanov avatar
    711 posts

    Posted 25 May Link to this post

    Hi Andreas,

    Thank you for writing.

    The observed behavior is an issue withing the printing engine of the grid. That is why I have logged it in our feedback portal. You can track its progress, subscribe for status changes and add your vote/comment to it on the following link - feedback item. I have also updated your Telerik Points.

    The item is already in development and a permanent fix will be available with our next official release.

    For the time being please use the workaround solution in the attached project. Basically, you would need to create custom renderer and print cells and then adjust the painting rectangle of the cell depending on the text padding.

    I hope this helps. Should you have further questions please do not hesitate to write back.

    Regards,
    Hristo Merdjanov
    Telerik
    Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms. For more information check out this blog post and share your thoughts.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Andreas Haeusler
    Andreas Haeusler avatar
    25 posts
    Member since:
    Nov 2009

    Posted 25 May in reply to Hristo Merdjanov Link to this post

    Hello Hristo,

     

    your fix works perfectly. Thank you very much.

     

    Kind regards,

    Andreas

Back to Top