If you already have strings like "10110" for each line/column, you can do it an easy way. For 5x5 grid:
Set text to replace(text, "11111", "5")
Set text to replace(text, "1111", "4")
Set text to replace(text, "111", "3")
Set text to replace(text, "11", "2")
Set text to replace(text, "00000", " ")
Set text to replace(text, "0000", " ")
Set text to replace(text, "000", " ")
Set text to replace(text, "00", " ")
Set text to replace(text, "0", " ")
.
A smarter way to do this is by counting "1" in each line in loops. See this demo:
dropbox.com/s/04ib2t619128hks/Nonogram.capx
It generates strings for Y axis in the array (rows), you can modify it for columns.