Hi,
how should I transform data from my DataSource to show spaces correctly in HtmlTextBox?
The HTML renderer ignores repeated spaces (as I expeceted), so I thought about replacing space character " " with the non-breaking space HTML entity " ".
It is actually feasible with HtmlTextBoxes with a constant content, but the space collapse is also applied on strings from DataSource, and this behavior is not acceptable, as those spaces are meaningful.
Is there a way to transform values from DataSource? I tried to wrap Fields references with the Replace() expression, trying to replace spaces with related HTML entity, but it does not work.
I paste a TRDX with embedded JSON data source down here:
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<
Report
DataSourceName
=
"jsonDataSource1"
Width
=
"17cm"
Name
=
"Try not to collapse spaces"
SnapGridSize
=
"0.1cm"
xmlns
=
"http://schemas.telerik.com/reporting/2021/1.0"
>
<
DataSources
>
<
JsonDataSource
Name
=
"jsonDataSource1"
>
<
Source
>
<
String
>ew0KICAiZm9vIjogInRoZSBzcGFjZXMgIGluc2lkZSAgIHRoaXMgICAgc3RyaW5nICAgICBzaG91bGQgbm90IGJlIGNvbGxhcHNlZCINCn0=</
String
>
</
Source
>
</
JsonDataSource
>
</
DataSources
>
<
Items
>
<
DetailSection
Height
=
"7cm"
Name
=
"detailSection1"
>
<
Items
>
<
HtmlTextBox
Width
=
"16cm"
Height
=
"1cm"
Left
=
"0.5cm"
Top
=
"1.7cm"
Value
=
"HTMLTextBox with Field: {Fields.foo}"
Name
=
"htmlTextBox1"
/>
<
HtmlTextBox
Width
=
"16cm"
Height
=
"1cm"
Left
=
"0.5cm"
Top
=
"6cm"
Value
=
"These spaces should not be dropped"
Name
=
"htmlTextBox2"
/>
<
HtmlTextBox
Width
=
"16cm"
Height
=
"1cm"
Left
=
"0.5cm"
Top
=
"3.4cm"
Value
=
"HTMLTextBox with Field: {Replace(Fields.foo, " ", " ")}"
Name
=
"htmlTextBox3"
/>
<
HtmlTextBox
Width
=
"16cm"
Height
=
"1cm"
Left
=
"0.5cm"
Top
=
"4.6cm"
Value
=
"HTMLTextBox with Field: {HtmlEncode(Fields.foo)}"
Name
=
"htmlTextBox4"
/>
<
TextBox
Width
=
"16cm"
Height
=
"0.9cm"
Left
=
"0.5cm"
Top
=
"0.3cm"
Value
=
"Standard TextBox with Field: {Fields.foo}"
Name
=
"textBox1"
/>
</
Items
>
</
DetailSection
>
</
Items
>
<
PageSettings
PaperKind
=
"A4"
Landscape
=
"False"
>
<
Margins
>
<
MarginsU
Left
=
"2cm"
Right
=
"2cm"
Top
=
"2cm"
Bottom
=
"2cm"
/>
</
Margins
>
</
PageSettings
>
<
StyleSheet
>
<
StyleRule
>
<
Style
>
<
Padding
Left
=
"2pt"
Right
=
"2pt"
/>
</
Style
>
<
Selectors
>
<
TypeSelector
Type
=
"TextItemBase"
/>
<
TypeSelector
Type
=
"HtmlTextBox"
/>
</
Selectors
>
</
StyleRule
>
</
StyleSheet
>
</
Report
>
What do you think I'm doing wrong?