Custom Function: Dynamic logo

Users may want to be able to dynamically display the logo of the user running the report in a report section, such as a page header. This example assumes the Load Image Prefix setting in the Admin Console is in use and that each user has a logo which follows the same naming format.

Arguments (Min - Max): 0 - 0


  • WebReports.Api.Reports




// Retrieve the user's CompanyId from the session.
// The user's preferred logo could also be passed in as a Parameter and retrieved instead.
string companyId = sessionInfo.CompanyId;

// Based on the companyId determine the Logo's file name.
string logoPath = "logo_" + companyId + ".png";

// Create formula text.
string formulaText = String.Format("=LoadImage(\"{0}\")", logoPath);

// Create embedded formula for LoadImage function
CellFormula formula = CellFormula.CreateFormula(sessionInfo.PageInfo, formulaText, CellVariableCollectionFilter.DataField);

// evaulate and return result
return formula.Evaluate(null);

Hidden Article Information

Article Author
Exago Development
created 2016-08-08 18:38:40 UTC
updated 2018-06-06 15:39:59 UTC

functions, change, example, custom function, user, switch, companyId,
Have more questions? Submit a request