This is a migrated thread and some comments may be shown as answers.

Text cropping in TextBox

2 Answers 205 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Sverre
Top achievements
Rank 2
Sverre asked on 11 Feb 2011, 12:07 AM
Hi!

I have some TextBoxes in a report that can only have a limited amount of horizontal space. If the TextBox contains the value "ab cdefgh", and the horizontal space available is to small to show all of the text, the textbox will only display "ab".

I have tried all the combinations I can think of the properties Multiline, TextWrap, CanGrow/Shrink and so on to get the TextBox to show the string cropped at the maximum length of the TextBox. I want the TextBox to show as much of the string as possible in the confined space. I would be happy to have the TextBox show "ab cdef" and half of the "g", if that was all there was space for. Even "ab cdef" is better than only "ab"... 

BTW: Wrapping to the next line is not an option in my case...

Best regards, 
Sverre H.

2 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 16 Feb 2011, 09:57 AM
Hi Sverre,

Do you use Carriage Return (\r) as new line character? If this is the case, then because Telerik Reporting and Silverlight are only able to handle line feed (\n) and \r\n as a new line character my suggesting is to use a replace method to manage the unexpected behavior. For example with the following User Function:

public static object ReplaceCarriageReturn(string value)
{
    return value.Replace("\r", "\r\n");
}

If you need additional assistance we will appreciate if you open a support ticket and send us a sample runnable project to debug locally.

Regards,
Peter
the Telerik team
Get started with Telerik Reporting with numerous videos and detailed documentation.
0
Sverre
Top achievements
Rank 2
answered on 16 Feb 2011, 03:04 PM
Thank You for your answer.

I don't really understand what you mean. I don't want the text in the field to wrap to the next line at all. I only want to display as much of the text as possible in the limited space available on one line. I don't have any CarriageReturn or NewLine characters in my text. 

I'm sorry that I didn't clearly state this in my first post, but my project is a WinForms-project... not Silverlight.

I'll make a sample project showing my issue tonight...

Sincerely
Sverre H.
Tags
General Discussions
Asked by
Sverre
Top achievements
Rank 2
Answers by
Peter
Telerik team
Sverre
Top achievements
Rank 2
Share this question
or