Scroll

Server Event: Translate static report content

This server event can be useful in a multi-language environment, where users who speak different languages all use a similar set of reports. This example hooks into the beginning of the report execution process, scans the cells for static text, then translates the text using a method you provide.

This can be set to run globally "OnReportExecuteStart" for every report, or it can be attached to individual reports.

Global Event: OnReportExecuteStart (optional)

Code

// this value would likely come from some authentication layer in the
// host app and assigned as a parameter value via the API
int langId;
if (!int.TryParse(sessionInfo.GetParameter("langId").Value, out langId))
    langId = 4; // set some sort of default

foreach (Cell cell in sessionInfo.Report.Cells)
    if (cell.IsStaticField || cell.IsStaticValueType)
        cell.Text = translate(cell.Text, langId); // define a custom translate method

// apply changes to the report
sessionInfo.Report.RecreateSections();

Hidden Article Information

Article Author
Exago Development
created 2017-09-20 16:07:21 UTC
updated 2017-10-31 17:09:28 UTC

Labels
spanish, SAE, event, example, server, translate,
Have more questions? Submit a request