Unwanted extra space in front of field in text block

Stimulsoft Reports.NET discussion
Post Reply
Scab
Posts: 4
Joined: Fri Dec 16, 2022 10:57 am

Unwanted extra space in front of field in text block

Post by Scab »

If we use a text block and we enter some text and on the next line start with a field from the datasource, the resulting report shows a space in front of that field, which messes up the alignment. We save the .mrt and then a .cs file to use from our project.

For example:
Some header
{myData.SomeFieldName}

Where myData.SomeFieldName equals "TEST" (without the quotes, but just to make clear there are no spaces surrounding the text)

Result in:
Some header
TEST

Notice the space in front of TEST.

Very sporadically this does not happen and I have found the cause. If you look at the .mrt file. Then I see the following:
When it goes wrong: _x005C_par_x000D__x000A__x007B_myData.SomeFieldName_x007D_
When it goes right: _x005C_par_x000D__x000A__x005C_f0_x007B_myData.SomeFieldName_x007D_

So sometimes it added _x005C_f0 and the extra space does not occur, but most of the times it is ommited and we get an extra space in the resulting report.

I can manually add the _x005C_f0 to the .mrt when this happens, but when the report is saved through the editor it might or might not remove it again, so I would like this fixed.
Lech Kulikowski
Posts: 7768
Joined: Tue Mar 20, 2018 5:34 am

Re: Unwanted extra space in front of field in text block

Post by Lech Kulikowski »

Hello,

Please send us a sample report that reproduces the issue for analysis.

Thank you.
Scab
Posts: 4
Joined: Fri Dec 16, 2022 10:57 am

Re: Unwanted extra space in front of field in text block

Post by Scab »

See the attached report and the png to show the problem from the resulting output.
Attachments
result.png
result.png (2.98 KiB) Viewed 3464 times
Report.mrt
(6.74 KiB) Downloaded 70 times
Lech Kulikowski
Posts: 7768
Joined: Tue Mar 20, 2018 5:34 am

Re: Unwanted extra space in front of field in text block

Post by Lech Kulikowski »

Hello,

This is a feature of the RichText component behavior when different text fragments are combined.
We cannot know in advance what will be there, so we add a space to isolate words and commands.

A possible solution is to set FullConvertExpression=true for the component. In this case, a different merge algorithm will be used and this issue will not occur.

Thank you.
Scab
Posts: 4
Joined: Fri Dec 16, 2022 10:57 am

Re: Unwanted extra space in front of field in text block

Post by Scab »

I will try if setting FullConvertExpression will work, but it is very strange to hear you find it acceptable that the outlining of the textblock is messed up otherwise, especially since I mentioned that adding \f0 in front of the field (x005C_f0) solves the problem as well. You know the item is on a new line, since there is a par x000D x000A there, so it does not need a space. I would think that if customers used this component, they could rely on the outlining inside that component. So why is this not the default behavior? Calling this bug a "feature" sounds a bit rich (pun intended) to me.
Lech Kulikowski
Posts: 7768
Joined: Tue Mar 20, 2018 5:34 am

Re: Unwanted extra space in front of field in text block

Post by Lech Kulikowski »

Hello,

We have added some fixes. Please check the next release build.

Thank you.
Post Reply