pdf grid row height auto adjust
Is there a way to adjust the grid row height based on length of text that is assigned to a grid cell?
I am using MeasureString method of a PDfFont instance to get the size and using that to set thr pdfgrid row height.
Hi Jp,
Thanks for using syncfusion product,
We have created the sample to calculate the string height and also adjusted the pdfGrid height with the string height, Please try the sample in your environment and let us know if you found any issue.
PdfGridIssues.zip
Thanks,
Chinnu
Hi Jp,
Thanks for using syncfusion product,We have created the sample to calculate the string height and also adjusted the pdfGrid height with the string height, Please try the sample in your environment and let us know if you found any issue.
PdfGridIssues.zip
Thanks,
Chinnu
thanks for the solution. however it does not give the correct height. modifying your code as below, you will observe that the height is not adjusted correctly
Hi Jp,
We have changed the sample as per your requirement, and also paste the code snippet for your reference. Please try this sample and let us know if you have any concern.
- Here we have calculated the column width as default to calculate the height of the PdfGrid row. You can also set the column width manually and calculate the height based on that width.
//Get total width of the page
float pagewidth = page.GetClientSize().Width;
//divide the grid column count to page width now get a single column width
float columnWidth = pagewidth /= numberOfColumn;
//divide the text width and column width
float lineCount = (size.Width / columnWidth)+1;
//set the row height
grid.Rows[0].Height = ((size.Height+1) * lineCount;
- In the second page of the generated PDF, we have created a CheckFontMeasuredString method to check the measured string value is correct or not. I have attached the output PDF document generated from our side; if you found any difference please provide us the PDF document generated from your side.
Sample link:
http://www.syncfusion.com/downloads/support/directtrac/general/PdfGridIssues1676239076.zip
Thanks,
Chinnu
Thanks for your update.
I am afraid that I am not able to reproduce the reported issue. I have attached the working sample for your reference could you please modify the sample to reproduce the issue so that we will analyse in this and provide you the solution at the earliest.
Sample Link:
http://www.syncfusion.com/downloads/support/forum/119192/ze/PdfGridIssues1147304709
Regards,
Chinnu
- 6 Replies
- 2 Participants
-
JB jb
- May 20, 2015 03:03 PM UTC
- Jul 23, 2015 10:31 AM UTC