Home
Analytics
Rendering dataset data as HTML in the report output
Razzie
I've a requirement whereby the user wants to perform his own formatting and layout of the contents of a document via a WYSIWYG editor. The resultant content is saved into one or more fields in a database table as content containing HTML tags (to retain the formatting). I would want to design the report such that the data fields when presented in the report design gets automatically rendered as HTML in the report output. In summary, I would want the data set rows to be able to set the 'Content Type' property as 'HTML', just like what can be done if a Text or Dynamic Text have been used.
How can this be done? I'm stuck!!!
Find more posts tagged with
Comments
KavithaD
Hi,
Even i am also having same requirement.if you got the solution can you share with me?
Thanks & regards
Kavitha
mwilliams
Are you trying to display the HTML in a table?
KavithaD
hi,<br />
<br />
I am storing HTML formatted data in data base.i.e Its storing data as <br />
<font color="#ffff00"> <br />
He should tall <br />
</font><br />
<font color="#ffff00" face="courier new"><br />
fsdfsdfsdf</font><br />
<font size="1" color="#ffff00"><br />
sdfsdf<br />
<font size="2"> <br />
testing<br />
[background=rgb(255, 0, 255);] the font size [/font]<br />
</font><br />
</font><br />
[background=rgb(255, 0, 255);]sdsdfsdf[/font] sdfsdfsdsd<br />
.<br />
I want to display this data in my report as HTML formatted.<br />
<br />
Can you tell me how i can achieve it?<br />
<br />
Thanks & regards<br />
Kavitha
mwilliams
Kavitha,
If you're bringing the html in as a string, like:
"<html></html>"
You can put a text element in your table, with type HTML selected from the drop down and an expression something like:
<VALUE-OF format="HTML">row["html"].replace('"', "");
row["html"].replace('"', "")</VALUE-OF>
The replace functions get rid of the quotes on the string.
Let me know if this works for you.
KavithaD
hi mwilliams,<br />
<br />
I have Indication field in grid.I gave that field as text.<br />
selected HTML from drop down and given <VALUE-OF format="HTML">dataSetRow["INCLUSION_CRITERIA"].replace('"', "");<br />
dataSetRow["INCLUSION_CRITERIA"].replace('"', "");</VALUE-OF> <br />
<br />
where dataSetRow["INCLUSION_CRITERIA"] is giving me html formatted value which is stored in data base i.e <strong class='bbc'> <font color="#ff0000">hjsgadlgjka</font></strong><br />
<br />
<br />
when i checked in preview i got this error<br />
The following items have errors: <br />
<br />
<br />
ReportDesign (id = 1): <br />
+ There are errors evaluating script "dataSetRow["INCLUSION_CRITERIA"].replace('"', "");<br />
dataSetRow["INCLUSION_CRITERIA"].replace('"', "");":<br />
ReferenceError: "dataSetRow" is not defined. (<inline>#1) <br />
birt.core.JavascriptCommonError ( 1 time(s) )<br />
detail : org.eclipse.birt.report.engine.api.EngineException: There are errors evaluating script "dataSetRow["INCLUSION_CRITERIA"].replace('"', "");<br />
dataSetRow["INCLUSION_CRITERIA"].replace('"', "");":<br />
ReferenceError: "dataSetRow" is not defined. (<inline>#1)<br />
at org.eclipse.birt.report.engine.executor.ExecutionContext.addException(ExecutionContext.java:1166)<br />
at org.eclipse.birt.report.engine.executor.ExecutionContext.addException(ExecutionContext.java:1118)<br />
at org.eclipse.birt.report.engine.executor.ReportItemExecutor.evaluate(ReportItemExecutor.java:286)<br />
at org.eclipse.birt.report.engine.executor.TextItemExecutor.executeHtmlText(TextItemExecutor.java:114)<br />
at org.eclipse.birt.report.engine.executor.TextItemExecutor.execute(TextItemExecutor.java:70)<br />
at org.eclipse.birt.report.engine.internal.executor.dup.SuppressDuplicateItemExecutor.execute(SuppressDuplicateItemExecutor.java:43)<br />
at org.eclipse.birt.report.engine.internal.executor.wrap.WrappedReportItemExecutor.execute(WrappedReportItemExecutor.java:46)<br />
at org.eclipse.birt.report.engine.internal.executor.l18n.LocalizedReportItemExecutor.execute(LocalizedReportItemExecutor.java:34)<br />
at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:64)<br />
at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:26)<br />
at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:135)<br />
at org.eclipse.birt.report.engine.layout.html.HTMLInlineStackingLM.resumeLayout(HTMLInlineStackingLM.java:106)<br />
at org.eclipse.birt.report.engine.layout.html.HTMLInlineStackingLM.layoutNodes(HTMLInlineStackingLM.java:155)<br />
at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:26)<br />
at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:135)<br />
at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:69)<br />
at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:26)<br />
at org.eclipse.birt.report.engine.layout.html.HTMLTableLM.layoutChildren(HTMLTableLM.java:112)<br />
at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:135)<br />
at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:69)<br />
at org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout(HTMLPageLM.java:90)<br />
at org.eclipse.birt.report.engine.layout.html.HTMLReportLayoutEngine.layout(HTMLReportLayoutEngine.java:99)<br />
at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.doRun(RunAndRenderTask.java:167)<br />
at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run(RunAndRenderTask.java:75)<br />
at org.eclipse.birt.report.service.ReportEngineService.runAndRenderReport(ReportEngineService.java:882)<br />
at org.eclipse.birt.report.service.BirtViewerReportService.runAndRenderReport(BirtViewerReportService.java:973)<br />
at org.eclipse.birt.report.service.actionhandler.BirtGetPageAllActionHandler.__execute(BirtGetPageAllActionHandler.java:131)<br />
at org.eclipse.birt.report.service.actionhandler.AbstractBaseActionHandler.execute(AbstractBaseActionHandler.java:90)<br />
at org.eclipse.birt.report.soapengine.processor.AbstractBaseDocumentProcessor.__executeAction(AbstractBaseDocumentProcessor.java:47)<br />
at org.eclipse.birt.report.soapengine.processor.AbstractBaseComponentProcessor.executeAction(AbstractBaseComponentProcessor.java:143)<br />
at org.eclipse.birt.report.soapengine.processor.BirtDocumentProcessor.handleGetPageAll(BirtDocumentProcessor.java:183)<br />
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)<br />
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)<br />
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)<br />
at java.lang.reflect.Method.invoke(Unknown Source)<br />
at org.eclipse.birt.report.soapengine.processor.AbstractBaseComponentProcessor.process(AbstractBaseComponentProcessor.java:112)<br />
at org.eclipse.birt.report.soapengine.endpoint.BirtSoapBindingImpl.getUpdatedObjects(BirtSoapBindingImpl.java:66)<br />
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)<br />
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)<br />
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)<br />
at java.lang.reflect.Method.invoke(Unknown Source)<br />
at org.apache.axis.providers.java.RPCProvider.invokeMethod(RPCProvider.java:397)<br />
at org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:186)<br />
at org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:323)<br />
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)<br />
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)<br />
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)<br />
at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:454)<br />
at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)<br />
at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699)<br />
at org.eclipse.birt.report.servlet.BirtSoapMessageDispatcherServlet.doPost(BirtSoapMessageDispatcherServlet.java:265)<br />
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)<br />
at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)<br />
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)<br />
at org.eclipse.birt.report.servlet.BirtSoapMessageDispatcherServlet.service(BirtSoapMessageDispatcherServlet.java:122)<br />
at org.eclipse.equinox.http.registry.internal.ServletManager$ServletWrapper.service(ServletManager.java:180)<br />
at org.eclipse.equinox.http.servlet.internal.ServletRegistration.handleRequest(ServletRegistration.java:90)<br />
at org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(ProxyServlet.java:111)<br />
at org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:59)<br />
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)<br />
at org.eclipse.equinox.http.jetty.internal.HttpServerManager$InternalHttpServiceServlet.service(HttpServerManager.java:318)<br />
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:502)<br />
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:380)<br />
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)<br />
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)<br />
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)<br />
at org.mortbay.jetty.Server.handle(Server.java:324)<br />
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:535)<br />
at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:880)<br />
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:748)<br />
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:213)<br />
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)<br />
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)<br />
at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:520)<br />
Caused by: org.eclipse.birt.core.exception.CoreException: There are errors evaluating script "dataSetRow["INCLUSION_CRITERIA"].replace('"', "");<br />
dataSetRow["INCLUSION_CRITERIA"].replace('"', "");":<br />
ReferenceError: "dataSetRow" is not defined. (<inline>#1)<br />
at org.eclipse.birt.core.script.ScriptContext.eval(ScriptContext.java:341)<br />
at org.eclipse.birt.core.script.ScriptContext.eval(ScriptContext.java:369)<br />
at org.eclipse.birt.report.engine.executor.ExecutionContext.evaluate(ExecutionContext.java:718)<br />
at org.eclipse.birt.report.engine.executor.ExecutionContext.evaluate(ExecutionContext.java:699)<br />
at org.eclipse.birt.report.engine.executor.ReportItemExecutor.evaluate(ReportItemExecutor.java:282)<br />
... 71 more<br />
Caused by: org.mozilla.javascript.EcmaError: ReferenceError: "dataSetRow" is not defined. (<inline>#1)<br />
at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3557)<br />
at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3535)<br />
at org.mozilla.javascript.ScriptRuntime.notFoundError(ScriptRuntime.java:3620)<br />
at org.mozilla.javascript.ScriptRuntime.name(ScriptRuntime.java:1652)<br />
at org.mozilla.javascript.gen.c6._c0(<inline>:1)<br />
at org.mozilla.javascript.gen.c6.call(<inline>)<br />
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:401)<br />
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3003)<br />
at org.mozilla.javascript.gen.c6.call(<inline>)<br />
at org.mozilla.javascript.gen.c6.exec(<inline>)<br />
at org.eclipse.birt.core.script.ScriptContext.eval(ScriptContext.java:336)<br />
... 75 more<br />
<br />
can you tell what to do for this.
KavithaD
Thanks alot mwilliams,your ans solved my problem.
mwilliams
Kavitha,
Glad to help. Let us know whenever you have questions.
Saikanth
hey williams
i am trying to render a report in HTML format in the output file the bottom& right border of the table is not visible, and even header image and footer placed in the master page are not rendered in the output HTML file.
please reply..
mwilliams
Can you attach your design?
Saikanth
i am previewing the below report as HTML and in the output file the border is invisible(bottom and right).In the master page i have included header image and footer which are invisible in the output.
mwilliams
Any way you can reproduce this with the sample database so that I can run it and test?