Home
Analytics
Multi lines in text element
Jazzc
<p>I've a text file with contents as (p1), I've a text element in BIRT report and with javascript coding in onCreate event as (j1), i'm expecting the result on the text element as (p1) but t<span>he truth is</span> <span>not what I want (see p2)</span>.</p>
<p> </p>
<p>p1</p>
<div>香港ä¹é¾™å°–沙咀金巴利é“39å·</div>
<div>电è¯ï¼š (852) 3763 8888 ä¼ çœŸï¼š (852) 3763 8899</div>
<div>info@theluxemanor.com</div>
<div>Attn: XXXXXXXXXXXXXXX</div>
<div>eMail: tommy.wong@gr8lc.com</div>
<div> </div>
<div>j1</div>
<div> </div>
<div>
<div>importPackage(Packages.java.io);</div>
<div>var buAdd=this.getRowData().getColumnValue("bu");</div>
<div>if(buAdd=="GRLC"){</div>
<div>var fileasstr = "";</div>
<div>var tmpstr = "";</div>
<div>filename = "/xampp/tomcat/webapps/birt-viewer/report/images/GRLC.txt";</div>
<div>buffreader = new BufferedReader(new InputStreamReader(new FileInputStream(filename), "utf-8"));</div>
<div>while((tmpstr = buffreader.readLine()) != null) {</div>
<div>fileasstr+=tmpstr;</div>
<div>}</div>
<div>buffreader.close();</div>
<div>this.text="Bill To:"+fileasstr;</div>
<div>} </div>
<div> </div>
<div> </div>
<div>p2</div>
<div>
<div>香港ä¹é¾™å°–沙咀金巴利é“39å·ç”µè¯ï¼š (852) 3763 8888 ä¼ çœŸï¼š (852) 3763 8899info@theluxemanor.com</div>
<div>Attn: XXXXXXXXXXXXXXXeMail: tommy.wong@gr8lc.com</div>
</div>
</div>
Find more posts tagged with
Comments
mwilliams
If you have html selected from the drop down for the content type, you should be able to just add a <br /> to fileasstr when you add tmpstr to it.
Jazzc
<p>I understand that what you have mentioned, but I really don't how to put this in my script, can you please complete it for me, thanks!</p>
mwilliams
fileasstr+=tmpstr + "<br />";<br><br>I would think that'd do it if you have html as the text box type.