Set Date format for whole report

Stimulsoft Reports.NET discussion
Post Reply
IskandarAir
Posts: 105
Joined: Thu Aug 17, 2017 12:07 pm

Set Date format for whole report

Post 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
IskandarAir
Posts: 105
Joined: Thu Aug 17, 2017 12:07 pm

Re: Set Date format for whole report

Post 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
Andrew
Posts: 4109
Joined: Fri Jun 09, 2006 3:58 am

Re: Set Date format for whole report

Post by Andrew »

Hello, Iskandar.

Thank you for sharing your solution here on the forum.
Post Reply