Page 1 of 1

Set Date format for whole report

Posted: Tue Nov 14, 2017 5:02 pm
by IskandarAir
Dear Stimulsoft Team,

I wonder whether it is possible to set dateformat for whole report in c# code by ourselves? We have clients in Europe and now in America (and they want MM/dd).

I am looking for something (pseudocode)

Report.setDefaultDateTimeFormat = new StiDateFormatService("dd/MM/yyyy", "");



IN CASE IF it is not possible

is it possible for StiText which has already set dateFormat

the solution can be for datetime


Regards,
Iskandar Anvarov

Re: Set Date format for whole report

Posted: Wed Nov 15, 2017 9:52 am
by IskandarAir
Dear Stimulsoft Team,

We have resolved this issue.

In case if others will need it, here is code snippets

Code: Select all

            var components = report.GetComponentsWithProperty("Text");

            var dateFormat = _reportRepository.GetDateFormat();
            foreach (var component in components)
            {
                if(component is StiText)
                {
                    var textCell = component.GetProperty("TextFormat") as StiFormatService;

                    if (textCell is StiDateFormatService)
                    {
                        ((StiText)component).TextFormat = new StiDateFormatService(dateFormat, "");
                    }
                }
            }
Regards,
Iskandar

Re: Set Date format for whole report

Posted: Wed Nov 15, 2017 2:39 pm
by Andrew
Hello, Iskandar.

Thank you for sharing your solution here on the forum.