Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I'm not sure exactly what you are trying to do in your code up there but here is some information i found about accessing a word document and a table within the doc:</p> <ol> <li><p>Microsoft Word Object Model</p> <p>This object model is part of Microsoft Word (not Javascript) and it lets you "automate" word remotely from other programs (not just web pages, but any computer program).</p> <p>It is primarily designed for Visual Basic, but can be accessed by Javascript from a web page - see para 2 below.</p> <p>However it is a bit more tricky to use through Javascript, particularly because you cannot use visual basic constants - you need to refer to them by value. If you research this further, you will soon know what I mean by this.</p> <p>So where can you find out about this Object Model?</p> <p>It is all there in the Word help files if you look for it.</p> <p>If you look in the Word help, under programming information, you will find the Microsoft Word Visual Basic Programming Reference.</p> <p>The Word object model, which lets you do things you will need to solve your problem like:</p> <ul> <li>Open Word</li> <li>Open a Document in Word</li> <li>Access the collection of Tables in that ActiveDocument.</li> <li>Access the Rows and Cells of a given Table.</li> </ul></li> <li><p>How do you access this from Javascript?</p> <p>This might only be done I think through Internet Explorer (and perhaps Opera).</p> <p>Here you need to learn about ActiveXObjects.</p> <p>ActiveXObjects (if you do not know) are separate computer programs which enable additional functionality. There are lots of ActiveX objects on the internet.</p> <p>When you install Word, this also installs an ActiveX object for automating word, giving you access to the Word Object Model.</p> <p>So in javascript, lets open up a new instance of word:</p> <pre><code>var oApplication=new ActiveXObject("Word.Application"); oApplication.Visible=true; // "Visible" is in the Word Object Model` </code></pre> <p>There you have it.</p> <p>Then if you want to open you file and get the table:</p> <pre><code>oApplication.Documents.Open("myfilename"); var oDocument=oApplication.ActiveDocument; var oTable=oDocument.Tables(1);` </code></pre></li> </ol> <p>And now I leave it to you to keep going with the rest. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload