Search code examples
labelmultilinelibreoffice

In libre office, how to set a multiline label programmatically?


In Calc (libre office), I need to set the label of a button in a macro, with 2 lines. But everything is displayed in one line.

nb=5
button.Multiline = true
button.Label = "You are our " & nb & "th visitor \n Thank you"

The character '\n' is displayed with the rest : "You are our 5th visitor \n Thank you"


Solution

  • Just use & Chr(10) & instead \n

    button.Label = "You are our " & nb & "th visitor" & Chr(10) & "Thank you"