When my string have spaces words get wrap in table. But because I wanted to preserve spaces in innerHTML so I replaced it with ‘\u00A0’ .
var newString = aString.replace(/\s/g,'\u00A0');
Now when newString gets render in the Table, It is not wrapping up because I have replaced white spaces with corresponding Unicode character.
getTableRow(rowIndex).cells(i).innerHTML = myRow[i]; //Here You can replace myRow[i] with newString
word-wrap CSS property is not working for me.
In short I have used \u00A0 to prevent consecutive spaces from collapsing to a single space but don’t really want to prevent line breaks.
I have found the solution .
Replace white space with brakable visible Unicode character ie “\u2009”. It is working perfectly for me.