I'm trying to include a simple HTML page (a small table) from a remote server in my report, unfortunately it looks not so simple, as I thought...
I'm using jasper-htmlcomponent in this way:
<componentElement> <reportElement x="129" y="50" width="300" height="350" uuid="b346885c-8588-427f-b9f3-e262c34ce1ed"/> <hc:html xmlns:hc="http://jasperreports.sourceforge.net/htmlcomponent" xsi:schemaLocation="http://jasperreports.sourceforge.net/htmlcomponent http://jasperreports.sourceforge.net/xsd/htmlcomponent.xsd" scaleType="RetainShape" horizontalAlign="Left" verticalAlign="Middle"> <hc:htmlContentExpression><![CDATA["<p>It works!</p>"]]></hc:htmlContentExpression> </hc:html> </componentElement>
That works. Then I thought, I could try something like:
"<frameset cols='100%'><frame src='http://myserver.com/test.html'></frameset>"
Unfortunately I get an empty page, though I can see in the Apache-Logs on the remote server, that the file "test.html" is being successfully downloaded from Jasper.
I've also tried with:
textFieldExpression / textElement markup="html"
but it's the same.
The only way I've found is to use
(new java.util.Scanner(new java.io.FileInputStream(new java.io.File("/opt/www/test.html"))))
but the real page I want to use is dynamically generated on a remote server, so this is no solution for me.
Can You please help?
Thank you in advance!
For those, who also want to include some remote HTML in report:
<hc:htmlContentExpression><![CDATA[(new java.util.Scanner(new java.io.BufferedReader(new java.io.InputStreamReader(new java.net.URL("http://path.to.server/page").openStream())))).useDelimiter("\\A").next()]]></hc:htmlContentExpression>
On jasperreport server 6.2.0 i have a "net.sf.jasperreports.engine.JRException: Error loading object from file" when i add a html component like this one but i have no error in jaspersoft studio