We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

PdfGrid Cannot word wrap correctly

Thread ID:





145476 Jun 24,2019 02:47 PM UTC Jul 5,2019 01:11 PM UTC WinForms 4
Tags: PDF
Daniel Kraut
Asked On June 24, 2019 02:47 PM UTC


I have a table implemented using PdfGrid. The table has 2 rows and 3 columns. First rows is simple text only, but second row has nested PdfGrid with only one column and few rows (i need to assign different fonts to different rows). When I insert a row with one word in the nested grid but the word is too long to be put on one line, it doesn't wrap correctly. It just ends with the last character possible to fit there (i have set some padding to the cells of parent table).

I discovered even weirder behaviour by accident, when I follow the word with newline and some characters, it wraps correctly (but shows only the first word). Let"s say the string is "toolongtofitoneline" which can only fit the "toolongtofit" part to one line. When I change the string to "toolongtofitoneline\n cat" and then add it to the grid, it wraps the "toolongtofit" and shows "oneline" on second row but nothing else (not the cat) part.

I tried setting the Style.StringFormat.WordWrap to Character but nothing helps. I have also found this question https://www.syncfusion.com/forums/130965/how-to-auto-wrap-long-text-field-in-column-in-grid but it does not apply to SyncFusion PDF library.

Best regards.

Surya Kumar [Syncfusion]
Replied On June 25, 2019 01:28 PM UTC

Hi Daniel, 

Greetings from Syncfusion. 

We have tried to reproduce the issue with the PdfGrid which you have described in the last update and the text inside the nested grid found to be preserved without any issues. We have attached the sample with code snippet which we have tried to reproduce the issue.  
Sample link: 

Could you please modify the code snippet like you have used and provide the code in which issue is reproduced. So that we could help you find solution. 

Surya Kumar 

Daniel Kraut
Replied On July 2, 2019 01:58 PM UTC

Hi Surya,

Sorry, I may have described the issue badly. I have edited the sample code you provide to demonstrate my issue:

#1 - My original issue: 
If I edit theline 62 from:

childGridRow1.Cells[0].Value = "toolongtofitoneline \n cat";


childGridRow1.Cells[0].Value = "TooLongToFitOnOneLineWithHelveticaFont";

in the final table there is displayed only "TooLongToFitOnOneLineWith" and nothing else. This was my original issue with SyncFusion PDF library. Meanwhile I have figured out that one way to force correct word wrapping is to explicitly set the width of that column, which gets quite complicated to do with nested grids when I want some columns to be dynamic.

#2 The weird behaviour:

I have found this when I was experimenting with how to solve my original problem. If I edit the line 68 from:

childGridRow3.Cells[0].Value = "toolongtofitoneline \n cat";


childGridRow3.Cells[0].Value = "TooLongToFitOneLineCourierFont";

The text is "cut off" the same as in my previous example. But when I edit that line to:

childGridRow3.Cells[0].Value = "TooLongToFitOneLineCourierFont \n cat";

It wraps only the "TooLongToFitOneLineCourierFont" correctly, but does not draw the "cat" part at all. I find it even weirder, that:

  • "TooLongToFitOneLineCourierFont\n" - this is not enough to force the word wrapping
  • "TooLongToFitOneLineCourierFont cat" - this is not enough to force the word wrapping
  • "TooLongToFitOneLineCourierFont\ncat" - this is enough, in another words it must be the newline character plus some other character(s)

Attachment: NestedGrid1629627736edited_80b5fcd1.zip

Surya Kumar [Syncfusion]
Replied On July 3, 2019 07:22 AM UTC

Hi Daniel, 

We are able to reproduce the behavior which you have mentioned. We are currently analyzing the same, we let you know more about this on 05-July-19. 

Surya Kumar 

Surya Kumar [Syncfusion]
Replied On July 5, 2019 01:11 PM UTC

Hi Daniel, 

Thank you for the patience. 

We confirm that the issue with “Contents inside the child grid are not word wrapped properly in PdfGrid” is a bug and the fix for this issue will be included in the Volume 2 SP1 release which is will be available on month of August 2019. 

Surya Kumar 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon