
Hi, I want to stretch text in textbox.
Not multiline, no padding, just fill inside which length of the textbox value
But, set textbox properties
Multiline: False
CanGrow: False
CanShrink: True
Docking: None
and then, make border to textbox
It looks like picture.
How I can stretch vertical in TextBox like this?
2 Answers, 1 is accepted
Hello Doeyong,
Embedded expressions are supported by some properties that expect string input. Such properties are TextBox.Value, CheckBox.Text, etc. - see the list here: Embedded Expressions.
For the remaining scenarios you should use simple concatenation, as shown below:
='<svg>
<g>
<text font-size="25">
<tspan x="0%" y="20%" textLength="60%">'+ Fields.goodsName+'</tspan>
</text>
</g>
</svg>'
The expression will be evaluated and the value of the goodsName field in the current data row will be used to populate the text of the SVG's <tspan> element.
Regards,
Ivan Hristov
Progress Telerik
May I have a question?
[Image - view at report viewer desktop application]
[Image-view at Html5 Report Viewer]
[Image-view at PrintPreview from Html5 Report Viewer]
[Image Edit Expression Dialog Value]
<svg>
<g>
<text font-size="25">
<tspan x="0%" y="20%" textLength="60%">TEST</tspan>
</text>
</g>
</svg>
[Image Bindings]
When I have a value for the location or size before the report is made, Stretch is applied normally as you suggested.
However, if you specify the location and size through the Report Parameter, the stretch is not applied normally. I want you to teach me about this part.
And, when viewed from Html5ReportViewer, the image with Stretch applied on the screen that came out by pressing the Print button (from Html5ReportViewer) is different.
Is there a way to print out the same?
The Size and the Location cannot be set directly through report parameters because these properties are not primitive types.
Both properties are of type Telerik.Reporting.Drawing.PointU and if you wish to set these properties through bindings, you would need to create a user function that returns an object of that type.
Regarding the last question, in order to have the report viewer display the report the same way as it will be when printed, you can set the viewMode property of the report viewer widget to PRINT_PREVIEW.
For more information, see the Interactive vs. Print Layout | Telerik Reporting article.
Hi Doeyong,
This functionality is not supported by the TextBox item. Its purpose is to render text runs in the bounds, calculated by the GDI+ routines for the specified text value and font size.
However, you can achieve this text stretching using the PictureBox item, because it can render SVG contents inline. SVG natively supports text elements, so if you paste in the PictureBox value the following expression:
<svg>
<g>
<text font-size="25">
<tspan x="0%" y="20%" textLength="60%">TEST</tspan>
</text>
</g>
</svg>
and set the PictureBox's Sizing property to Stretch, you'll get the following result:
Similar result can be achieved also when applying a transform to the SVG text. If you set the PictureBox's Sizing property to Normal and change the expression as shown below:
<svg>
<g transform="scale(1,5)">
<text font-size="20">
<tspan x="0" y="15" textLength="60%">TEST</tspan>
</text>
</g>
</svg>
the rendered result would be similar:
It's up to you to decide which approach would work better in your scenario.
Regards,
Ivan Hristov
Progress Telerik
Hi, Thanks to your answer. I have a question of parameter.
<svg>
<g>
<text font-size="25">
<tspan x="0%" y="20%" textLength="60%">'${Fields.goodsName}'</tspan>
</text>
</g>
</svg>
svg tag in to imagebox edit expression dialog, it shows image which you said.
I have two question.
When I get value in dynamic reporting, like picture, TEST to Fields.goodsName.
Like this.
How I can change Text by Fields Value or Parameter Value?