eggchun32 Posted March 16, 2021 Share Posted March 16, 2021 My Jaspersoft Studio version: 6.5.1.finalAs my question mentioned, I want to break new line for my data when it detect some characters such as "/".For example,$F{data} = "AB/CD/E/F/"The layout that I want to export in PDF:-->"AB/CD/ E/F/"-->"AB/CD/ E/ F/"-->"AB/ CD/ E/ F/"I have also researched on Google and found that some solutions are using split method in textfield: $F{data}.split("/").I have tried but it seems not work for me when export in PDF just like the picture below.Is that any possible solution to solve this layout problem?Or am I using the split method incorrectly?Thank you!! Link to comment Share on other sites More sharing options...
Solution jabrown Posted March 18, 2021 Solution Share Posted March 18, 2021 Hello,You should be able achieve this by using the following expression for your text field. I belive the Java function you'll want to use is replace rather than split. You will replace your defined character with a new line."AB/CD/E/F/".replace("/","rn")Your JRXML for the text field value will be as follows.<textFieldExpression><![CDATA["AB/CD/E/F/".replace("/","rn")]]></textFieldExpression>I hope this helps solve your challenege! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now