In many reports I have for example a field formatted as „Date“. The expression for this field is for example
{Format("{0:dd.MM.yyyy}", DateStart)} - {Format("{0:dd.MM.yyyy}", DateEnd)}
In former versions of Stimulsoft Report it was interpreted as string if there was an expression other than a date.
In the version 2019.2.3.0 only the first date would be displayed in this field. The rest of this string will not be displayed.
There is an easy way to solve this problem by using format „General“ instead of “Date”.
But there are already many decentralized reports.
Is it possible to redo this behaviour, if there is more content then one date in the field?
If it is not possible, can you provide a method how I could locate such fields before rendering the report and change the field format from “Date” to “General” in the code of the report.
Please find attached an example report.
Thanks
Date Field does not show string anymore
Date Field does not show string anymore
- Attachments
-
- Example Date-Format does not show text.mrt
- (7.63 KiB) Downloaded 166 times
Re: Date Field does not show string anymore
Hello,
Thank you.
Unfortunately no.Is it possible to redo this behaviour, if there is more content then one date in the field?
You can use the following code, for example:If it is not possible, can you provide a method how I could locate such fields before rendering the report and change the field format from “Date” to “General” in the code of the report.
Code: Select all
report.Load("example date-format does not show text.mrt");
var comps = report.GetComponents();
foreach (StiComponent comp in comps)
{
var txt = comp as StiText;
if ((txt != null) && (txt.TextFormat is Stimulsoft.Report.Components.TextFormats.StiDateFormatService) && txt.Text.Value.Contains("{Format"))
{
txt.TextFormat = new Stimulsoft.Report.Components.TextFormats.StiGeneralFormatService();
}
}
Re: Date Field does not show string anymore
Thank you.
I will try the code provided.
I will try the code provided.
-
- Posts: 6271
- Joined: Tue Mar 20, 2018 5:34 am
Re: Date Field does not show string anymore
Hello
Ok.
Please let us know if you need any additional help.
Thank you.
Ok.
Please let us know if you need any additional help.
Thank you.