Going off the example at http://code.google.com/apis/spreadsheets/gadgets/ ,
the value for the cell is formatted by this function.

function escapeHtml(text) {
  if (text == null) {
    return '';
  }
  return _hesc(text);
}

You'd probably need to apply it to the result of _hesc(text) before
returning it.  I can't find documentation for the _hesc function, but I
presume it makes a string 'safe' by converting actual <'s to &lt;'s, and it
leaves whitespace alone.

so possibly the function you want is:

function escapeHtml(text) {
  if (text == null) {
    return '';
  }
  return _hesc(text).replace("\n", "<br/>");
}

But since we don't know exactly what _hesc does, you'll want to actually
examine the return value of the function in a debugger, to see if you've
converted "a\nb" to "a<br/>b" and not "ab".  It seems that at the moment
you're managing to get "a&lt;br/&rt;b".


cheers,
David.


On Sun, May 22, 2011 at 2:16 AM, Mike <[email protected]> wrote:

> Thanks so much, but either I don't know where to put your snippet and
> how to use it, or your snippet needs to be modified.
> Here's a test:
> http://sites.google.com/site/michaelmccolin/
>
> The gadget file I've used is accessible on the same page.
>
>

Reply via email to