Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Text wrap in Table cell
MaverickS
I made a BIRT report design in which table's cell has dynamic text whose length is more than cell length.
Due to this text is not coming properly and fully.
So please tell me how to wrap the text in new line.
Regards,
Maverick S
Find more posts tagged with
Comments
Azad Singh
<blockquote class='ipsBlockquote' data-author="'MaverickS'" data-cid="101313" data-time="1337920769" data-date="24 May 2012 - 09:39 PM"><p>
I made a BIRT report design in which table's cell has dynamic text whose length is more than cell length.<br />
<br />
Due to this text is not coming properly and fully.<br />
<br />
So please tell me how to wrap the text in new line.<br />
<br />
<br />
Regards,<br />
Maverick S<br /></p></blockquote>
<br />
<br />
<br />
HI Maverick, Can u try using overflow property of "Cell"? I think i have done this in past using this property. <br />
<br />
What ever you can find the best solution, please post here after solving the problem
.<br />
<br />
Anyways i am attachinig a screenshot, plz have a look.
MaverickS
Overflow is not working.
Please suggest any other way.
Thanks,
Maverick
MaverickS
I tried this function wrap , it is working properly i.e wrapping the text to next line if length increases more than 20 ,but it is throwing an exception which is mentioned below.<br />
<br />
Plz help.<br />
<br />
function wrap(longStr,width){<br />
length = longStr.length; <br />
if(length <= width)<br />
return longStr;<br />
return (longStr.substring(0, width) + "\n" + wrap(longStr.substring(width, length), width));<br />
}<br />
<br />
wrap(dataSetRow["Data Set2::ecp_logon_param_value"],20);<br />
<br />
A BIRT exception occurred. See next exception for more information.<br />
Error evaluating Javascript expression. Script engine error: TypeError: <strong class='bbc'>Cannot read property "length" from null</strong> Script source: null, line: 1, text:<br />
<compiled script> (Element ID:1500) <br />
data.engine.BirtException ( 1 time(s) )<br />
detail : org.eclipse.birt.report.engine.api.EngineException: A BIRT exception occurred. See next exception for more information.<br />
Error evaluating Javascript expression. Script engine error: TypeError: Cannot read property "length" from null<br />
Script source: null, line: 1, text:<br />
<compiled script> (Element ID:1500)<br />
at org.eclipse.birt.report.engine.executor.ExecutionContext.addException(ExecutionContext.java:1206)<br />
at org.eclipse.birt.report.engine.executor.ExecutionContext.addException(ExecutionContext.java:1185)<br />
at org.eclipse.birt.report.engine.executor.DataItemExecutor.execute(DataItemExecutor.java:101)<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:65)<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:140)<br />
at org.eclipse.birt.report.engine.layout.html.HTMLInlineStackingLM.resumeLayout(HTMLInlineStackingLM.java:111)<br />
at org.eclipse.birt.report.engine.layout.html.HTMLInlineStackingLM.layoutNodes(HTMLInlineStackingLM.java:160)<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:140)<br />
at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:70)<br />
at org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren(HTMLStackingLM.java:26)<br />
at org.eclipse.birt.report.engine.layout.html.HTMLTableBandLM.layoutChildren(HTMLTableBandLM.java:67)<br />
at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:140)<br />
at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:70)<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:132)<br />
at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:140)<br />
at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:70)<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:140)<br />
at org.eclipse.birt.report.engine.layout.html.HTMLInlineStackingLM.resumeLayout(HTMLInlineStackingLM.java:111)<br />
at org.eclipse.birt.report.engine.layout.html.HTMLInlineStackingLM.layoutNodes(HTMLInlineStackingLM.java:160)<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:140)<br />
at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:70)<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:132)<br />
at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:140)<br />
at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:70)<br />
at org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout(HTMLPageLM.java:92)<br />
at org.eclipse.birt.report.engine.layout.html.HTMLReportLayoutEngine.layout(HTMLReportLayoutEngine.java:100)<br />
at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.doRun(RunAndRenderTask.java:180)<br />
at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run(RunAndRenderTask.java:77)<br />
at org.eclipse.birt.report.service.ReportEngineService.runAndRenderReport(ReportEngineService.java:929)<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.GeneratedMethodAccessor34.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.service(ServletRegistration.java:61)<br />
at org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(ProxyServlet.java:126)<br />
at org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:60)<br />
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)<br />
at org.eclipse.equinox.http.jetty.internal.HttpServerManager$InternalHttpServiceServlet.service(HttpServerManager.java:317)<br />
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)<br />
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390)<br />
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)<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:326)<br />
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)<br />
at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:939)<br />
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)<br />
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)<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:582)<br />
Caused by: org.eclipse.birt.data.engine.core.DataException: A BIRT exception occurred. See next exception for more information.<br />
Error evaluating Javascript expression. Script engine error: TypeError: Cannot read property "length" from null<br />
Script source: null, line: 1, text:<br />
<compiled script><br />
at org.eclipse.birt.data.engine.core.DataException.wrap(DataException.java:123)<br />
at org.eclipse.birt.data.engine.expression.BytecodeExpression.evaluate(BytecodeExpression.java:54)<br />
at org.eclipse.birt.data.engine.expression.ExprEvaluateUtil.evaluateCompiledExpression(ExprEvaluateUtil.java:205)<br />
at org.eclipse.birt.data.engine.expression.ExprEvaluateUtil.evaluateCompiledExpression(ExprEvaluateUtil.java:219)<br />
at org.eclipse.birt.data.engine.expression.ExprEvaluateUtil.evaluateExpression(ExprEvaluateUtil.java:76)<br />
at org.eclipse.birt.data.engine.impl.BindingColumnsEvalUtil.evaluateValue(BindingColumnsEvalUtil.java:201)<br />
at org.eclipse.birt.data.engine.impl.BindingColumnsEvalUtil.getColumnsValue(BindingColumnsEvalUtil.java:161)<br />
at org.eclipse.birt.data.engine.impl.ResultIterator.prepareCurrentRow(ResultIterator.java:757)<br />
at org.eclipse.birt.data.engine.impl.ResultIterator.<init>(ResultIterator.java:166)<br />
at org.eclipse.birt.data.engine.impl.QueryResults.getResultIterator(QueryResults.java:208)<br />
at org.eclipse.birt.report.engine.data.dte.QueryResultSet.<init>(QueryResultSet.java:98)<br />
at org.eclipse.birt.report.engine.data.dte.DteDataEngine.doExecuteQuery(DteDataEngine.java:168)<br />
at org.eclipse.birt.report.engine.data.dte.AbstractDataEngine.execute(AbstractDataEngine.java:265)<br />
at org.eclipse.birt.report.engine.executor.ExecutionContext.executeQuery(ExecutionContext.java:1897)<br />
at org.eclipse.birt.report.engine.executor.QueryItemExecutor.executeQuery(QueryItemExecutor.java:80)<br />
at org.eclipse.birt.report.engine.executor.TableItemExecutor.execute(TableItemExecutor.java:62)<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:65)<br />
... 64 more<br />
Caused by: org.eclipse.birt.core.exception.CoreException: Error evaluating Javascript expression. Script engine error: TypeError: Cannot read property "length" from null<br />
Script source: null, line: 1, text:<br />
<compiled script><br />
at org.eclipse.birt.core.script.JavascriptEvalUtil.wrapRhinoException(JavascriptEvalUtil.java:303)<br />
at org.eclipse.birt.data.engine.expression.BytecodeExpression.evaluate(BytecodeExpression.java:55)<br />
... 82 more<br />
Caused by: org.mozilla.javascript.EcmaError: TypeError: Cannot read property "length" from null<br />
at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3654)<br />
at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3632)<br />
at org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3660)<br />
at org.mozilla.javascript.ScriptRuntime.typeError2(ScriptRuntime.java:3679)<br />
at org.mozilla.javascript.ScriptRuntime.undefReadError(ScriptRuntime.java:3692)<br />
at org.mozilla.javascript.ScriptRuntime.getObjectProp(ScriptRuntime.java:1421)<br />
at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3027)<br />
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2487)<br />
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:164)<br />
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:398)<br />
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3065)<br />
at org.mozilla.javascript.InterpretedFunction.exec(InterpretedFunction.java:175)<br />
at org.eclipse.birt.data.engine.expression.BytecodeExpression.evaluate(BytecodeExpression.java:49)<br />
... 82 more<br />
<br />
<br />
<br />
<br />
<br />
<br />
Thanks,<br />
Maverick
HPP
hi mavericks,
I have done this. Pls select the particular cell go to its property editor and go to advanced's property,
and set as shrink to true.
CBR
Hi Maverik,<br />
<br />
concerning your function you have to add a nullsafety. Looks like the error occurs if the string is null. Change function to:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
function wrap(longStr,width){
if(longStr==null) {
return null;
}
length = longStr.length;
if(length <= width)
return longStr;
return (longStr.substring(0, width) + "\n" + wrap(longStr.substring(width, length), width));
}
</pre>
MaverickS
Thanks HPP & cbrell for replying.
HPP - I tried your solution but it is not working.
cbrell - Your solution is working absolutely fine .Thanks a lot.
Regards,
Maverick S