If you want to add a new line, you must do this between quotes. For example, if you have two Strings you wish to join, with each on a new line, then the following should work.
$String1 + '
' + $String 2
Notice that the start quote and end quote are on different lines.
I hope this helps.
I managed to solve it for myself. Maybe this will help others too.
1. I used this formatting: ‘string 1’ + ‘<br /><br />’ + ‘string 2’.
2. I changed the setting in the rich text editor for the enter action to break lines instead of paragraphs.
3. It shows the break in the rich text field.
I'm trying to view this string in a rich text box.
// This file was generated by Mendix Studio Pro.
//
// WARNING: Only the following code will be retained when actions are regenerated:
// - the import list
// - the code between BEGIN USER CODE and END USER CODE
// - the code between BEGIN EXTRA CODE and END EXTRA CODE
// Other code you write will be lost the next time you deploy the project.
// Special characters, e.g., é, ö, à, etc. are supported in comments.
package myfirstmodule.actions;
import com.mendix.systemwideinterfaces.core.IContext;
import com.mendix.webui.CustomJavaAction;
public class AppendStringsNewLine extends CustomJavaAction<java.lang.String>
{
private final java.lang.String constantString;
private final java.lang.String currentString;
private final java.lang.String resultString;
public AppendStringsNewLine(
IContext context,
java.lang.String _constantString,
java.lang.String _currentString,
java.lang.String _resultString
)
{
super(context);
this.constantString = _constantString;
this.currentString = _currentString;
this.resultString = _resultString;
}
@java.lang.Override
public java.lang.String executeAction() throws Exception
{
// BEGIN USER CODE
StringBuilder result = new StringBuilder(resultString);
if (result.length() == 0) {
result.append(constantString);
}
result.append("\n").append(currentString);
return result.toString();
// END USER CODE
}
/**
* Returns a string representation of this action
* @return a string representation of this action
*/
@java.lang.Override
public java.lang.String toString()
{
return "AppendStringsNewLine";
}
// BEGIN EXTRA CODE
// END EXTRA CODE
}
use this java action, for any use case