re-open
Public

When using the ForeUI editor I can put line breaks into table cells (by entering backslash-n).

Is there some way to do the same thing from an action? When I try to use a backslash-n in the “Set Cell Value” action, like this:

what I get in the table is this:

I’ve tried several other possibilities like backslash-x0A, #013; and \r, but nothing I have tried works.

Might it be possible to accomplish this using a JavaScript snippet?

Thanks!

1 answer

Staff July 24, 2016

Hi Hephaestus, 

At the time being the action for setting table cell value only take the value as text instead of HTML. We will improve this in future version.

Meanwhile you can work around it by using your own Javascript function to set the value. You can put this function in the “Script” element (green “JS” icon in the element list):

var setTableCellHtml = function(elemId, row, col, value) {
$(“#”+elemId).find(“.contentView”).children(“.content”).children().children(“tr”).eq(row – 1).children(“td”).eq(col – 1).find(“.table_cell”).html(htmlToView(value));
}

Then you can call this function using the “Call Javascript Snippet” action. Below is an example:

Please notice the correct format of newline, it is “\\n” because we need to escape the slash in the parameter.

 

 

 

#1
  1. Hi ViVi, that works beautifully, thank you! Something I should mention for anyone else wanting to try this: just copying and pasting the JavaScript into the snippet editor will *NOT* work, because the quote and hyphen (minus sign) characters in the article text above are not ASCII characters, but rather, Unicode left and right double quotes (0x201C, 0x201D) and "en dash" (0x2013). After pasting the text, one needs to work through the text and replace each of their characters with their equivalents typed from the keyboard.

Please login or Register to Submit Answer