3

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

I saw that the TableCell object doesn't have the method insertTable so i cannot call it though the cell. The table's method insertTable can receive only the "Before" and "After" locations - so the new one will be inserted just before or after the parent table.

I've manage to nest table though HTML by 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 the javacript API?

Thanks!

sborpo
  • 928
  • 7
  • 15
  • Excel tables are not in any way akin to HTML tables. They are two entirely different structures designed to support very different scenarios. Could you explain what you are trying to accomplish? – Marc LaFleur Jul 31 '17 at 15:21
  • Just want to create a dynamic nested table based on some data. I can do it by writing an ugly java-script function which produces an html table and then send it to insertHtml Or by producing the table by API code . I just need the user to see a table in his document – sborpo Jul 31 '17 at 15:26

0 Answers0