Insert a table in a selected portion of a word document


Insert a table in a selected portion of a word document

Hello, I am developing a simple add in for word where a user selects an area on the document and then click the button on the add in that says "generate table" and then a table is generated in the user selected section. Right now I know how to insert only text where the user selects.

var range = context.document.getSelection(); range.insertText("text", Word.InsertLocation.end);

That is how I do it with text, but with a table I cannot call document.getSelection and simply gange inserText to insertTable. I believe when I insert a table i have to call document.body which doesn't allow me to use the users selection in my code. Any ideas?

Submitted July 13, 2017 at 01:00AM by Iwrestlenow
via reddit http://ift.tt/2uRLpvb

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s