Cell and Text Wrapping

Hi,

I want the cell to auto wrap a text when a user resize the cell's height.
I tried to set the TextWrapping attribute of the cell style but
that do nothing.

Can you help me ?

Thanks,
P.OM
Reportive SA

3 Replies

DP Dhinesh Pandiyan M Syncfusion Team February 1, 2010 02:35 PM UTC

Hi Puthirak,

Thanks for using Syncfusion products.

We need to set TextWrapping for Wrap the content. If we need to wrap the content on resizing then We need to listen the ResizingColumns event and call the ResizeRowsToFit() method for make content fit. Use the below code.

grid.Model.IndentColumnStyle.TextWrapping = TextWrapping.Wrap;

void grid_ResizingColumns(object sender, GridResizingColumnsEventArgs args)
{ this.grid.Model.ResizeRowsToFit(GridRangeInfo.Table(), GridResizeToFitOptions.None);
}

Please download the sample from the below location.

http://www.syncfusion.com/uploads/redirect.aspx?file=TextWrapResizing_71b05bde.zip&team=development

Let us know if you have any other questions.

With Regards,
Dhinesh Pandiyan


PA paul October 1, 2010 09:02 PM UTC

Hello,

The text wrapping solution wouldn't work when the cell type is RichText. For example having:

myFlowDoc = new FlowDocument();
myFlowDoc.Blocks.Add(new Paragraph(new Run(data)));
gridControl.Model[2, 2].CellValue = myFlowDoc;
gridControl.Model[2, 2].CellType = "RichText";

Is there any way to wrap the text when the type is RichText?

Many Thanks.



JJ Jeraldes J Syncfusion Team October 12, 2010 09:11 AM UTC

Hi Paul ,

Sorry for the delay caused. We have created a RichText sample to achieve your requirement. Please download the sample from the following location:

[Sample Link]
http://www.syncfusion.com/uploads/redirect.aspx?file=RichTextBox_7327c279.zip&team=development


In the sample you can find in RichTextBoxCellRenderer we have added CalculatePreferredCellSize method to calculate the richtextbox cell size as per the content.

Let us know if you need any other details.

Regards,
Jeraldes J



Loader.
Up arrow icon