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
close icon

How to wrap cell content

I couldn't find a method in SfDatagrid that will automatically wrap the text in a cell. How do I go about this?


2 Replies

VS Vijayarasan Sivanandham Syncfusion Team October 6, 2022 09:16 AM

Hi Olayinka,

Your requirement to wrap the text and fit the row height based on the text in the grid cell in SfDataGrid can be achieved by using the QueryRowHeight event and setting the AllowTextWrapping property in GridColumn. For more information related to Fit the Row Height based on its content, please refer to the below user guide documentation link,


UG Link: https://help.syncfusion.com/windowsforms/datagrid/rowheightcustomization#fit-row-height-based-on-its-content

https://help.syncfusion.com/windowsforms/datagrid/rowheightcustomization#reset-the-rowheight-at-runtime

Please find the sample in the attachment and let us know if you have any concerns about this.


Regards,

Vijayarasan S


If this post is helpful, please consider Accepting it as the solution so that other members can locate it more quickly.


Attachment: Sample_df688192.zip


WI will November 15, 2022 12:36 AM

Select the cells that you want to format. On the Home tab, click Wrap Text. Text inside the cell wraps to fit the column width. When you change the column width, text wrapping adjusts automatically.


Regards,

Will


Loader.
Live Chat Icon For mobile
Up arrow icon