I make little script to apply a group of comands in the text. I select some text, apply Paragraph style, transform to Table apply styles (table and cell styles) and unfortunatelly each line stay in a different cell. I need to make all in one cell only.
How do I do this? Please, help.
This is the script:
myText=app.selection.appliedParagraphStyle = "Norma DO";
myTable = myText.convertToTable("\t", "\r",);
myTable.appliedTableStyle = "DOU";
myTable.cells.itemByRange(0,-1).appliedCellStyle = "Célula DOU";
This last line doesn't work, gives error.
First, the Merge command is not a valid function on cells. You probably meant 'merge'.
Then, merge does not work on 'cells' -- an array of cells. Rather, it works on either one single cell (and you'd have to tell it with what other cell to merge), or on an entire collection of cells.
Finally, since this is a function, it needs a pair of parentheses.
So this does work:
specifying a collection to merge, or, alternatively,
telling to merge everything from the first cell to the last cell.
Thanks a lot Jongware.
It works fine.