Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: Daiim on May 16, 2022, 07:31:50 pm

Title: EA.Element.Notes linebreak?
Post by: Daiim on May 16, 2022, 07:31:50 pm
Hi there,

I try to set the text to an element notes property, but the "\n" linebreaks within the strings are simply ignored. Does anyone know how to do a linebreak? (More formatting tipps are welcome, too.)

That does not work as \n are ignored :/
Code: [Select]
var someElement as EA.Element;
someElement.Notes = "First text line.\nSecond text line.";

Thank you guys for helping me out!

Daiim
Title: Re: EA.Element.Notes linebreak?
Post by: Geert Bellekens on May 16, 2022, 07:39:40 pm
What language?

In your example you are using "\t", not "\n"

Geert
Title: Re: EA.Element.Notes linebreak?
Post by: Daiim on May 16, 2022, 07:42:32 pm
What language?

In your example you are using "\t", not "\n"

Geert

Thank you for that hint - fixed it in the post.
I'm using JScript.
Title: Re: EA.Element.Notes linebreak?
Post by: Geert Bellekens on May 16, 2022, 07:53:37 pm
this might help: https://stackoverflow.com/a/36527267/2018133 (https://stackoverflow.com/a/36527267/2018133)

Geert
Title: Re: EA.Element.Notes linebreak?
Post by: Daiim on May 16, 2022, 08:40:06 pm
Thanks, Geert for your hint - close but simplier as I tried another apporach and read formatted text from notes. It points out, that it is html:
Quote
<u>And</u> a new Line. <a href="$inet://www.heise.de"><font color="#0000ff"><u>Links</u></font></a> are also possible.   

Sorrowly there are no newlines shown, but after playing around - no, it is not html, it is necessary to use a '\r\n' (carriage return + newline). Works fine now.