Is linebreaks supported in labels?

Jun 25, 2014 at 9:37 AM
I'm using labels with my map, and they are shown with the exception that they haven't any linebreaks. So some of my labels are saying "Hello\nWorld!", where \n should be a linebreak in this case.

Is linebreak supported in some way?
Developer
Jun 25, 2014 at 9:57 AM
Just tried it - linebreaks (\r\n or \n) works fine with map labels.
Jun 25, 2014 at 11:28 AM
It doesn't work for me.
Image

My code:
Dim ls As New LabelSymbolizer()
ls.LabelAngleField = "VINKEL"
ls.UseLabelAngleField = True

Me.uiMap.AddLabels(layer, "[DESCRIPTIO]", "", ls, 500)
Developer
Jun 25, 2014 at 1:03 PM
Is this text "ID:648013\nkW: 11\nFami....." is content of "DESCRIPTIO" field?
Jun 25, 2014 at 1:34 PM
Yes.

And I'm using DotSpatial 1.6 via nuget.
Developer
Jun 26, 2014 at 6:33 AM
Ok, i've created simple application using DS1.6 and it also shows line breaks. Maybe something wrong with your data? Please share your data, so i can check it.
Jun 26, 2014 at 9:14 AM
Here's my data: https://drive.google.com/file/d/0ByLuNOsgtVuCSXhwcHJpNHFzdHc/edit?usp=sharing (click on File --> Download, or hit Ctrl+S once you opened the link).
Developer
Jun 26, 2014 at 10:43 AM
Edited Jun 26, 2014 at 11:07 AM
your field values are something like this:
currValue = "ID: 648044\\nkW: 74\\nSunnanvinden Trading AB\\nFallvindsgatan 4\\nKvдllsvinden 2"
if you want linebreaks, then values should be:
currValue = "ID: 648044\nkW: 74\nSunnanvinden Trading AB\nFallvindsgatan 4\nKvдllsvinden 2"
i.e. you need to replace all double backslashes with single ones, because in C# & VB.NET "\\" mean character "\".
Marked as answer by mogikanin on 6/26/2014 at 5:21 AM
Jun 26, 2014 at 11:11 AM
This is strange, when I open the .shp file in AutoCAD and take a look at the DataTable, there are no double backslashes.
Developer
Jun 26, 2014 at 11:14 AM
but probably you see "\n". But new line symbol is nonprinting and you should see nothing.
Jun 26, 2014 at 11:55 AM
I'm sorry, but I can't find anything wrong with my data. Here are pictures from another program, QGIS.

This first screenshot shows the raw data and output.
Image

This second screenshot shows when I have added \n as a linebreak.
Image


Are you sure that you get my data to work on your computer? Are you sure that DotSpatial doesn't add a second backslash to my data? Because I really can't see anything wrong with my data.
Developer
Jun 26, 2014 at 12:36 PM
Edited Jun 26, 2014 at 12:37 PM
Yes, i'm sure. Again, new line breaks is nonprinting symbol, so in any program you should see nothing (or new line). But you see "\n" and dotspatial shows to you the same. If you want to show linebreaks, then you should replace "\\" to "\" - for that you can create a simple program using DotSpatial.

But now your data contains two characters '\' and 'n', but should contains only one non printing symbol '\n' (char code 10).