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
office-js javascript-api-for-office


source to share


No one has answered this question yet

Check out similar questions:

2
Get message body using JavaScript API for Office
2
JavaScript API for Word 2016 API for Word, body.getHtml () and body.getOoxml () not working
1
How to insert table inside contentControl using Word javascript api
1
Open Excel document programmatically with javascript office api
1
Word: cannot InsertText () in Cell.body
0
SearchOptions using Word sequence number - MS Office Word Addin OfficeJS
0
Is there any Office Apps API to open a sharepoint word file in a client application
0
Inserting table at cursor in Word document using Javascript API
0
Office js - discrepancy in Word Desktop vs Online Tables
0
How to merge Word table cells using Office-js



All Articles
Loading...
X
Show
Funny
Dev
Pics