# Multiline output with CloudDeploy FormFunction

I wish to display multiple lines of text as output from CloudDeploy FormFunction.

I have tried using a string containing \n with no luck. Using Column works to some degree but I cannot create empty lines and cannot left align the text. It is always centered.

CloudDeploy[
FormFunction[
{"x" -> "String", "y" -> "String"},
Column[{#x, "",#y}] &
]
]


I have tried using the solution from FilePrint doesn't print file when running on Wolfram Programming Cloud

However this did not work(no line breaks in output)

• Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! – Michael E2 May 18 '16 at 18:03

Yes, it seems Column and Row are still broken (How to add a Style string or Hyperlink in CloudDeploy?). Let's use Spacer to create space.

Also Grid seems to respect Alignment option:

CloudDeploy[
FormFunction[
{"x" -> "String", "y" -> "String"},
Grid[List /@ {#x, Spacer[1], #y, #y, #y}, Alignment -> Left] &
]
]


In general you can exert quite a bit of control over the results by using an XMLTemplate. For example:

hoverGrid=
"<!DOCTYPE html>
<html>
<style>
table {
width:100%;
}

th, td {
border: 1px solid black;
text-align: right;
}

tr:hover{background-color:lavender}
</style>
<body>
<* Column[{#x,#y}] *>
</body>
</html>";


It's worthwhile to check TemplateExpression (which appears in the template as <*expr*>). If you need more spacings, use the CSS styling to do so (probably padding).

CloudDeploy[
FormFunction[{"x" -> "String", "y" -> "String"},
XMLTemplate[hoverGrid][##] &, "HTML"], "testLines",
Permissions -> "Public"]


here is the result:

To display multiple lines in a browser insert a <br> tag between each line:

CloudDeploy[
FormFunction[{"x" -> "String", "y" -> "String"}, #x <> "<br>" <> #y & ],
FileNameJoin[{\$CloudRootDirectory, "TwoLineTextOutput"}]]