This is a migrated thread and some comments may be shown as answers.

No padding when printing cells with HTMLRendering

2 Answers 35 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Andreas Haeusler
Top achievements
Rank 2
Andreas Haeusler asked on 24 May 2016, 03:11 PM

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 Answers, 1 is accepted

Sort by
0
Accepted
Hristo
Telerik team
answered on 25 May 2016, 11:16 AM
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.
0
Andreas Haeusler
Top achievements
Rank 2
answered on 25 May 2016, 12:30 PM

Hello Hristo,

 

your fix works perfectly. Thank you very much.

 

Kind regards,

Andreas

Tags
GridView
Asked by
Andreas Haeusler
Top achievements
Rank 2
Answers by
Hristo
Telerik team
Andreas Haeusler
Top achievements
Rank 2
Share this question
or