Nest tables with Office Javascript API in Word

I want to nest a table object inside another table cell using the javascript office api.

I saw that the TableCell object does not have an insertTable method, so I cannot call it even though the cell. The insertTable table method can only accept the "Before" and "After" locations, so the new one will be inserted immediately before or after the parent table.

I was able to insert a table though HTML using this code:

body.insertHtml('
<table border="1">
<tr>
<td>Cell1</td><td>Cell2</td>
</tr>
<tr>
<td>
    <table border=3 color=black>
    <tr><td>10</td><td>20</td><td>30</td></tr</table>
    </td>
<td>Cell 4</td>
</tr>
</table>', Word.InsertLocation.start);

      

Is there a way to nest a table with javacript API?

Thank!

+3


source to share





All Articles