🚀 Welcome to MDriven Learn –  MDriven is now on Discord!  Don’t miss the latest Release Notes.
OCLOperators XHtmlReportAsString
Created by Lars.olofsson on 2020-06-18 · Last edited by Sandra.akech on 2025-12-12.

XHtmlReportAsString(nameOfViewModel) works with XHTML content and transforms it using data from the ViewModel returning a string with XHTML.


Example:

A ViewModel contains:

  • Name = "Sandra"
  • Age = 30

XHTML template contains placeholders:

<div>
  Name: {Name}
  <br/>
  Age: {Age}
</div>

Run:

self.XHtmlReportAsString(MyViewModel)

Result:

<div>
  Name: Sandra
  <br/>
  Age: 30
</div>

The operator:

  • Finds {Name} replaces with "Sandra"
  • Finds {Age} replaces with "30"
  • Returns the whole XHTML as a string


See HtmlReport for more information.