It's all about the answers!

Ask a question

How to add linefeed or newline in description?


JazzRUs Gogh (1061311) | asked Oct 28 '11, 4:18 p.m.
Hi,

This is RAM version is v7.2.0.1, I have a long string with line feeds characters in it to break the string into a few lines, I have it print the string out on the java console and it appears the linefeed works. But when assign it to newAsset.setDescription(String), on the web client, the description section appear not having any linefeeds or new lines, it appear to be one long string. I have tried both "\n" and "\r\n" and both failed to appear.

Thanks!

JR.

6 answers



permanent link
Chris Graham (367914) | answered Oct 31 '11, 2:18 a.m.
Have you tried encoding it in hex?


<ram>
BUILD_LABEL = ${build.label}

BUILD_URL = <a href='${build.url}' target='_blank' > Build Info<a>

SOURCE_REPOSITORY_ADDRESS = <a href='${src.repository}' target='_blank' > Source Repository<a>

BUILD_RESULT_UUID = ${build.id}

BUILD_DEFINITION_ID = ${build.def.id}

</ram>



Hi,

This is RAM version is v7.2.0.1, I have a long string with line feeds characters in it to break the string into a few lines, I have it print the string out on the java console and it appears the linefeed works. But when assign it to newAsset.setDescription(String), on the web client, the description section appear not having any linefeeds or new lines, it appear to be one long string. I have tried both "\n" and "\r\n" and both failed to appear.

Thanks!

JR.

permanent link
Sheehan Anderson (1.2k4) | answered Oct 31 '11, 10:23 a.m.
JAZZ DEVELOPER
You can include HTML in your description. For a new line, you could use a <br> tag.

newAsset.setDescription("line 1<br>line 2");

permanent link
JazzRUs Gogh (1061311) | answered Oct 31 '11, 10:44 a.m.
Reply to Chris message:
Did you try it yourself before you suggest this?

I just tried it, it got worst, all appear in Hex codes.






Have you tried encoding it in hex?


<ram>
BUILD_LABEL = ${build.label}

BUILD_URL = <a href='${build.url}' target='_blank' > Build Info<a>

SOURCE_REPOSITORY_ADDRESS = <a href='${src.repository}' target='_blank' > Source Repository<a>

BUILD_RESULT_UUID = ${build.id}

BUILD_DEFINITION_ID = ${build.def.id}

</ram>



Hi,

This is RAM version is v7.2.0.1, I have a long string with line feeds characters in it to break the string into a few lines, I have it print the string out on the java console and it appears the linefeed works. But when assign it to newAsset.setDescription(String), on the web client, the description section appear not having any linefeeds or new lines, it appear to be one long string. I have tried both "\n" and "\r\n" and both failed to appear.

Thanks!

JR.

permanent link
JazzRUs Gogh (1061311) | answered Oct 31 '11, 10:53 a.m.
Yes Sheehan, your suggestion works but not Chris's.
Thanks SheeHan



You can include HTML in your description. For a new line, you could use a <br> tag.

newAsset.setDescription("line 1<br>line 2");

permanent link
Chris Graham (367914) | answered Nov 03 '11, 10:09 p.m.
No, sorry I didn't try it. It came straight out of one of the examples.

Silly me... :-)

-Chris

Reply to Chris message:
Did you try it yourself before you suggest this?

I just tried it, it got worst, all appear in Hex codes.






Have you tried encoding it in hex?


<ram>
BUILD_LABEL = ${build.label}

BUILD_URL = <a href='${build.url}' target='_blank' > Build Info<a>

SOURCE_REPOSITORY_ADDRESS = <a href='${src.repository}' target='_blank' > Source Repository<a>

BUILD_RESULT_UUID = ${build.id}

BUILD_DEFINITION_ID = ${build.def.id}

</ram>



Hi,

This is RAM version is v7.2.0.1, I have a long string with line feeds characters in it to break the string into a few lines, I have it print the string out on the java console and it appears the linefeed works. But when assign it to newAsset.setDescription(String), on the web client, the description section appear not having any linefeeds or new lines, it appear to be one long string. I have tried both "\n" and "\r\n" and both failed to appear.

Thanks!

JR.

permanent link
Gili Mendel (1.8k56) | answered Nov 04 '11, 8:08 a.m.
JAZZ DEVELOPER
Remember that on the web, the description is rendered as HTML ... so line feeds and such are ignored by the browser.

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.