Question
Nicky Zhu · Jun 6, 2017

How to embed web page code in zen report?

Hi, guys,

I'm working on zen report to display an examination report for a client.

They stored order information in several tables. Examination findings and diagnosis were recorded in a html page and codes of the page was stored in another table. We need to put them together in one single report.

So far we can only read the html codes from that table  which is a whole page since it start from label <html> and have <header>. We know that if we are using javascript we can display the page by assigning the codes to innerHtml property of an iframe object.

How can we do something like that in Zen Report? Or, if we can not, how can we display that page, starting from its html codes?

Thanks a lot. 

00
4 0 6 349
Log in or sign up to continue

Replies

HTML can be output using normal <item> tags with the copyHtml attribute.

By the way, I see you're a member of QP's team. I'd suggest talking with some of the local Trak technical specialists -- they are experts in Zen reports.

Hi Marc,

I came across your post trying to get HTML markup correctly formatted into a Zen Report PDF. We did manage to get this done using a <write/> element's content attribute report-wide. This time, we need to get variable markup by a report data node - hence we need to use an <item/> element.

Unforunately we cannot get this to work, neither via copyhtml nor via copyxml (and combinations of the two).

Should not at least one of the alternatives below generate the desired bold typing of the parameters MYMARKUP or MYXML?

Thanks for looking into this!

Class test.ZenReportItemHtml Extends %ZEN.Report.reportPage
{ 

Parameter DEFAULTMODE = "pdf";

Parameter MYMARKUP = "<p><b>Testing HTML markup</b></p>";

Parameter MYXML = "<fo:block font-weight='bold'><fo:inline>Testing XML FO</fo:inline></fo:block>"; 

XData ReportDefinition [ XMLNamespace = "http://www.intersystems.com/zen/report/definition" ]
{
<report xmlns="http://www.intersystems.com/zen/report/definition" name="Test" runonce="true">
     <element name="MyMarkup" expression="..#MYMARKUP" />
     <element name="MyXML" expression="..#MYXML" /> 
</report>
} 

XData ReportDisplay [ XMLNamespace = "http://www.intersystems.com/zen/report/display" ]
{
<report xmlns="http://www.intersystems.com/zen/report/display" name="Test">     
    <document width="8.5in" height="11in" marginLeft="1.25in"
      marginRight="1.25in" marginTop="1.0in" marginBottom="1.0in">
    </document>
    <body>
        <line style="dotted" />
        <div style="font-weight:bold;"><item value="markup plain"/></div>
        <div><item field="MyMarkup" /></div>         

        <line style="dotted" />
        <div style="font-weight:bold;"><item value="markup copyhtml=true"/></div>
        <div><item field="MyMarkup" copyhtml="true" /></div>         

        <line style="dotted" />
        <div style="font-weight:bold;"><item value="markup copyhtml=true createtable=true"/></div>
        <div><item field="MyMarkup" copyhtml="true" createtable="true" /></div>         

        <line style="dotted" />
        <div style="font-weight:bold;"><item value="markup copyhtml86=true"/></div>
        <div><item field="MyMarkup" copyhtml86="true" /></div>         

        <line style="dotted" />
        <div style="font-weight:bold;"><item value="markup copyhtml=true copyhtml86=true"/></div>
        <div><item field="MyMarkup" copyhtml="true" copyhtml86="true" /></div>         

        <div style="margin-top:2em;"></div>

        <line style="dotted" />
        <div style="font-weight:bold;"><item value="xml plain"/></div>
        <div><item field="MyXML" /></div>         <div style="margin-top:2em;"></div>

        <line style="dotted" />
        <div style="font-weight:bold;"><item value="xml copyxml=true"/></div>
        <div><item field="MyXML" copyxml="true" /></div>     </body> </report>
} 

}

The following sample works for me. HTML rendering capabilities are limited by what Apache FOP can handle.

Class test.ZenReportItemHtml Extends %ZEN.Report.reportPage
{

Parameter DEFAULTMODE = "pdf";

Parameter MYMARKUP = "<div style='font-weight:bold'>bold</div><br/><div>not-bold</div>";

XData ReportDefinition [ XMLNamespace = "http://www.intersystems.com/zen/report/definition" ]
{
<report xmlns="http://www.intersystems.com/zen/report/definition" name="Test" runonce="true">
     <element name="MyMarkup" escape="html" expression="..#MYMARKUP" />
</report>
}

XData ReportDisplay [ XMLNamespace = "http://www.intersystems.com/zen/report/display" ]
{
<report xmlns="http://www.intersystems.com/zen/report/display" name="Test">     
    <document width="8.5in" height="11in" marginLeft="1.25in"
      marginRight="1.25in" marginTop="1.0in" marginBottom="1.0in">
    </document>
    <body>
        <item field="MyMarkup" copyhtml="true" />
     </body>
 </report>
}

}

<strong> works as well:

Parameter MYMARKUP = "<strong>bold</strong><br/>not-bold";

Great tip, Marc! Thanks for your help yes

Thanks Marc, both the solution and the suggestion!