ReportListener HTML Foundation Class (TMM)

 
Visual FoxPro 9.0 SP2
This page is an addendum to an existing FFC class topic, covering enhancements in SP2.
Back to TMM Index
GeneralAbout this class

Like its parent class, XMLDisplayListener, HTMLListener received the responsibility to add various HTML-specific extension attributes into the VFP-RDL base in SP2. 

Each one of the following new member properties of HTMLListener corresponds to an associated Advanced Property name in reporting MemberData.  HTMLListener treats each of the Advanced Properties as instructions for generating the corresponding extension attribute.

New Member Property Default value Corresponding
Advanced Property
Usage
anchorAttr anchor HTML.Anchor both bands and layout controls
cssClassAttr css HTML.CSSClass.ExtendFRX all layout controls *
cssClassOverrideAttr CSS HTML.CSSClass.OverrideFRX all layout controls *
linkAttr hlink HTML.Link  all non-TEXTAREA expressions and text labels, as well as images.  Note that, if a single layout control has both HTML.Link and HTML.PrintablePageLink defined, HTML.Link takes precedence.
titleAttr title HTML.Alt-Title image controls (provides "alt" attribute) and all others (provides "title" attribute)

In addition to the new attributes it adds directly, HTMLListener's default output provides  support for all XMLDisplayListener-added attributes representing dynamic display changes and XMLListener's new attributes representing the original data type and content of formatted expressions. These attributes do not require associated Advanced Properties for you to indicate that you want to use them. They automatically come into play whenever you use EvaluateContents or AdjustObjectSize to change report content at runtime.

HTMLListener also exposes an Advanced Property leveraging the pageImageAttr member property added by XMLListener in SP2. With this new attribute, XMLListener provide support for UtilityReportListener's ability to export a page image file for each page of output. The associated Advanced Property, HTML.PrintablePageLink, allows you to associate that page file name with a particular layout control, which can be a non-TEXTAREA expression, a text label, or an image.  The HTML result is a link from the image or text item in the HTML page to the separate printable page file.  This means you can provide a "printable" version of each page, as a clickable link, from each page of content, at any position on the page and using whatever prompt (such as "click me") or whatever button image you like.

 

Tip note Tip

Each usage defined for these HTML-specific Advanced and Document Properties depends, in practice, on the XSLT Transform used by the HTMLListener at runtime. In SP2's copy of XSOURCE, both XSLTProcessorUser-SP2.xslt and XSLTProcessorUser-RTM.xslt are included in the Report Output Application source folder. You can derive the class's default XSLT file from the HTMLListener source in the FFC, or from any HTMLListener instance:

* -- make sure default XSLT is currently loaded
#DEFINE OUTPUTAPP_LOADTYPE_RELOAD 2
DO (_REPORTOUTPUT) WITH 5,,OUTPUTAPP_LOADTYPE_RELOAD 
? _oReportoutput["5"].xsltProcessorUser.Stylesheet.XML
                        

When you examine the SP2 version of the default user transform, you will see how and where it uses each of the new attributes. You will also see that it has been extensively re-organized from the RTM and SP1 versions for increased maintainability and readability.he RTM and SP1 versions for increased maintainability and readability.

The examples in the How to: docoid will show you what happens when the default SP2 XSLT is loaded. However, the availability of these various Reporting metadata extensions is a feature of VFP-RDL XML, not HTMLListener's default XSLT. Non-default HTML-producing XSLT transformations -- whether based on edited version of the default XSLTs or completely different -- have full access to them, because they work from the same XML source.


This class also has two new-in-SP2 utility methods that are marked PUBLIC because they could be useful in non-reporting web-related scenarios, as follows:

  • pathEncode(tcVal [,tlXMLEncode]) encodes sections of a URL path  and re-creates the URL from the elements. The second parameter indicates whether you want to re-encode the value suitable for including in well-formed XML.
  • urlStringEncode(m.tcValue[, m.tlEncodeURLControlChars][, m.tlEncodeSpace]]) encodes a string for purposes of using it as part of a link in an HTML page.  Thanks to Rick Strahl for the original version of this Xbase rendition of a common .NET function resolving a very common issue.  HTMLListener's version of the code adds optional parameters suited to its own specific needs.

* Further discussion of some of the the HTML-specific attributes for individual FRX layout elements, as well as HTML-specific Document-level Properties, are in the TMM docoid  How to: Use Advanced HTML Properties in Reports.

See AlsoSee Also