HTML Fragments
5 min
there are two major use cases for html fragments first, html fragments can be used as styling commands for example, you can import a tag to make the text bold the second case is to import html content, for example, from a rich text control on a web page in this case, the html is meant to be richly formatted content using html markup autotag's html facilities are designed to enable fragments of html to be processed as subreports this guide explains how html fragments can be used as blueprint document generation templates inserting html fragments html fragments can be stored in the database as text, or as a link to a file containing the actual html data html fragments that are stored as text in a database can be inserted into a report with the out tag html fragments that are stored as a link to an html file can be inserted into a report with the import tag whether you use the out tag or the import tag to insert html into the report, be sure to set the type attribute of the tag to "template" example inserting html with the out tag the following xml data file has an html fragment stored in the \<inline> tag \<root>\<inline>\<!\[cdata\[\<b>hello, world!\</b>]]>\</inline>\</root> the html fragment can be inserted into the report using the following out tag \<wr\ out select="/root/inline" type="template"/> the produced output will be hello, world! example inserting html with the import tag suppose you have the following xml data \<root>\<file>//fragment html\</file>\</root> you can insert fragment html with the following template \<wr\ import select="/root/file" type="template"/> the produced output will correspond to whatever is in the fragment html formatting with html fragments the formatting effects of the imported html tags persist throughout the document for example, if the imported html contains only a formatting tag such as the tag, then the character formatting will become bold example using imported html to format the document suppose you have the following xml data \<root>\<boldon>\<!\[cdata\[\<b>]]>\</boldon>\<boldoff>\<!\[cdata\[\</b>]]>\</boldoff>\</root> now suppose you have the following in your template not bold \<wr\ out select="/root/boldon" type="template"/>bold \<wr\ out select="/root/boldoff" type="template"/> not bold the produced output will be not bold bold not bold