QGIS – How to Prevent Label Text from Wrapping

labelingqgis

I have a polygon layer and am using single labels with an expression that creates a three line label using three fields:
Label expression: "name" || '\n' || "report" || '\n' || "depth"

For some reason text wrapping is happening for the third line (depth field). The first two lines are not wrapping (name and report fields). I don't want text wrapping.
(QGIS version 3.30.2)
enter image description here

enter image description here

Best Answer

It looks like your depth field has line breaks in the data itself (you can test this by typing "depth" in the Expression Dialog box; you would see the text with line breaks in the Preview section below).

If that is the case, you would need to strip out the linebreaks from the depth field, by using replace("depth",'\n','') instead of just "depth" .