Wrapping text on a PdfTextBoxField

Hi All,

I'm trying to wrap the text that I add to a text field. 

For example, I have two Textboxes one next to each other on a report with a separation between them of let say 10 (of wherever is the measure item), has a set width and I add a text to the left textbox that it is too big for that text field and overflow into the right text field. 


How Can I make the text to wrap on that text field?

This is an image of the issue, probably you guys where confuse of my explanation.
Image_8134_1738681623608  


1 Reply

IJ Irfana Jaffer Sadhik Syncfusion Team February 5, 2025 01:51 PM UTC

Hi Luis,


To resolve this issue where text overflows from one textbox into the adjacent one in a report, you can use the MultilineText API or the AutoResizeText API. Here's an explanation and a sample for each approach:

Option 1: Using MultilineText API

The MultilineText API allows the text to wrap within the specified width of the textbox. This ensures that the content is confined to the textbox without overflowing.

Example (using MultilineText):

leftTextBoxField.Multiline = true; // Enable multiline (text wrapping)

In this example, setting Multiline = true ensures that text in the left textbox wraps inside the textbox without overflowing into the right one.

Option 2: Using AutoResizeText API

Alternatively, the AutoResizeText API can be used if you'd like the textbox size to adjust automatically to fit the content (e.g., expanding vertically to accommodate the entire text). However, if you're looking to prevent overflow and keep the text within a fixed width, the MultilineText approach is likely a better fit.

Example (using AutoResizeText):

//Enable auto resize.

loadedField.AutoResizeText = true;


In this example, enabling AutoResizeText allows the textbox to expand vertically to fit the text without overflowing into adjacent elements.

Conclusion:

  • For wrapping text within the textbox (to prevent overflow), use MultilineText.
  • For resizing the textbox to fit the content dynamically, use AutoResizeText.


Follow the links below for more information:

Working with AutoResizeText | Syncfusion UG Documentation

Working with Multiline Text in TextBoxField in the PDF document | Syncfusion UG documentation


We request you to try this on your end and share with us the modified sample or steps to replicate the issue with us. So that we can assist with you further in this.


Regards,
Irfana J.


Loader.
Up arrow icon