How to stretch in TextBox?

2 Answers 367 Views
Report Designer - Web Report Parameters
Doyeong
Top achievements
Rank 1
Doyeong asked on 20 Jul 2022, 09:30 AM | edited on 21 Jul 2022, 12:35 AM

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

Sort by
1
Accepted
Ivan Hristov
Telerik team
answered on 25 Jul 2022, 09:06 AM

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

Brand new Telerik Reporting course in Virtual Classroom - the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products. Check it out at https://learn.telerik.com/.
WoorimartDEV
Top achievements
Rank 1
Iron
Iron
commented on 29 Jul 2022, 05:41 AM | edited

Thanks
Doyeong
Top achievements
Rank 1
commented on 29 Jul 2022, 05:56 AM | edited

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?

Dimitar
Telerik team
commented on 02 Aug 2022, 11:26 AM

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.

0
Ivan Hristov
Telerik team
answered on 22 Jul 2022, 03:42 PM

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

Brand new Telerik Reporting course in Virtual Classroom - the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products. Check it out at https://learn.telerik.com/.
Doyeong
Top achievements
Rank 1
commented on 25 Jul 2022, 08:29 AM | edited

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?

Tags
Report Designer - Web Report Parameters
Asked by
Doyeong
Top achievements
Rank 1
Answers by
Ivan Hristov
Telerik team
Share this question
or