Globalize MVC report with GlobalizationManager.

Stimulsoft Reports.WEB discussion
Post Reply
IvanPatrick
Posts: 2
Joined: Fri Oct 31, 2014 5:36 pm

Globalize MVC report with GlobalizationManager.

Post by IvanPatrick »

Hi dear, :D

I'm working in a MVC report and I have difficult in find a sample of MVC Globalization of a report.

I'm read the documentation and saw the sample in webform globalization, but dont have sucess in globalize a MVC application.

I try globalize the designer and the view with AspGlobalResource. This sample that I have maid.

Code: Select all

public virtual ActionResult GetReportSnapshot()
        {
            StiReport report = new StiReport();
            report.AutoLocalizeReportOnRun = true;
            report.GlobalizationManager = new GlobalizationManager("Namespace.Resources.Relatorio", System.Threading.Thread.CurrentThread.CurrentCulture);
            report.Load(this.PathRelatorio);

            report.RegBusinessObject(this.NomeModelDTO, this.DadosRelatorio);
            report.Dictionary.SynchronizeBusinessObjects(3);

            report.Compile();

            return StiMvcMobileViewer.GetReportSnapshotResult(this.HttpContext, report);
        }
Code for designer view.

Code: Select all

@Html.Stimulsoft().StiMvcDesigner(
                           new StiMvcDesignerOptions
                            {
                                ActionGetReportTemplate = "GetReportTemplateDesigner",
                                ActionSaveReportTemplate = "SaveReportTemplateDesigner",
                                ActionGetReportSnapshot = "GetReportSnapshotDesigner",
                                Width = System.Web.UI.WebControls.Unit.Percentage(100),
                                Height = System.Web.UI.WebControls.Unit.Pixel(800),
                                PrintAllowToPdf = false,
                                PrintAllowToHtml = false,
                                AllowModifyConnections = false,
                                AllowModifyDictionary = false,
                                ShowSaveFileDialog = false,
                                ViewerShowButtonSave = false,
                                MainMenuShowNew = false,
                                MainMenuShowNewReport = false,
                                MainMenuShowExitButton = false,
                                MainMenuShowOpenReport = false,
                                MainMenuShowOpenReportFromGoogleDocs = false,
                                MainMenuShowSaveAs = false,
                                LocalizationDirectory = Url.Content("~/Areas/Relatorios/Content/Localization"),
                                Localization = System.Threading.Thread.CurrentThread.CurrentCulture.Name,                                
                                ActionGetLocalization = "GetLocalization",
                            })
Code for mobile View.

Code: Select all

@Html.Stimulsoft().StiMvcMobileViewer("MvcViewerRelatorio",
                          new StiMvcMobileViewerOptions()
                          {
                              ActionGetReportSnapshot = "GetReportSnapshot",
                              ActionViewerEvent = "ViewerEvent",
                              ServerTimeout = new TimeSpan(900000000000),
                              ActionPrintReport = "PrintReport",
                              ActionExportReport = "ExportReport",
                              Localization = System.Threading.Thread.CurrentThread.CurrentCulture.Name,
                              //ActionGetLocalization = "GetLocalization",
                          })
Have a sample off this question? I found nothing related in topics. :?

Att,

Ivan Patrick Fontanive.
Vladimir
Posts: 1462
Joined: Fri Apr 13, 2007 4:05 am
Location: Earth

Re: Globalize MVC report with GlobalizationManager.

Post by Vladimir »

Hello Ivan,

We have prepared the sample MVC project for you, please see the attached ZIP archive.
MvcViewer Globalization.zip
(9.59 MiB) Downloaded 240 times
Thank you.
IvanPatrick
Posts: 2
Joined: Fri Oct 31, 2014 5:36 pm

Re: Globalize MVC report with GlobalizationManager.

Post by IvanPatrick »

Hi Vladimir,

Thanks, now its works :D.

One last doubt :?:. What is the need of this code in the "GlobalizationManager"?

Code: Select all

public string[] GetTextGlobalizedNames()
        {
            return new string[]
			{
				"Company",
				"Address",
				"Phone",
				"Contact",
				"PageNofM",
				"ReportName"
			};
        }

        public string[] GetImageGlobalizedNames()
        {
            return new string[]
			{
				"Flag"
			};
        }
I already have the names in property "Globalized Name" of report! Still need put names in this array "GetTextGlobalizedNames"?

Thanks.

Ivan Patrick Fontanive
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Globalize MVC report with GlobalizationManager.

Post by HighAley »

Hello, Ivan.

You should describe all Globalized Names in this array. Without this the globalization manager will not work.

Thank you.
Post Reply