title: Is there a correct way to save document from Javascript Api for Office in Word Desktop client?
body: <h3>Context</h3>
  <p>I am writing an Office Word Task Pane Addin using JavaScript API for Office (v 1.1).</p>
  <p>My system :</p>
  <ul>
  <li>Microsoft Windows 8.1</li>
  <li>Microsoft Visual Studio 2015 Community</li>
  <li>Latest Visual Studio Tools for Office</li>
  <li>Microsoft Office Word Service Pack 1 (Desktop)</li>
  </ul>
  <hr />
  <h3>Problem</h3>
  <p>The problem I am facing is about saving the opened document in the client machine. I have searched for information, but remain unsuccessful...</p>
  <p>I would like to know if there is a way to save Word document from the JavaScript API, there are only a few methods in the Office.Context.Document :</p>
  <p><a href="https://i.stack.imgur.com/RtoFr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RtoFr.png" alt="enter image description here" /></a></p>
  <hr />
  <h3>Code</h3>
  <p>I wrote a solution but I dont like the way I used to save document by creating Word.Application Activex :</p>
  <pre><code>$scope.saveDocument = function (draft) {
      // Draft is a part of the window title
      // Example : 
      // ----------
      // If word window title shows &quot;B0306-000-2012.docx - Word&quot;, 
      // draft could be &quot;B0306-000-2012&quot;
      try {
          var Word = new ActiveXObject(&quot;Word.Application&quot;);
          if (Word) {
              var spanish = Word.Language == 3082;
              var Tasks = Word.Tasks;
              for (var i = 0; i &lt; Tasks.Count; i++) {
                  var Task = Tasks.Item(i + 1);
                  if (Task.Visible &amp;&amp; Task.Name.indexOf(draft) &gt;= 0) {
                      var shell = new ActiveXObject(&quot;WScript.Shell&quot;);
                      var activated = shell.AppActivate(Task.Name, 2000); //Espera 2 segundos para activar la aplicación
                      shell.SendKeys(spanish ? &quot;^g&quot; : &quot;^s&quot;, 3000); //Envía el comando Ctrl + (G / S) según el idioma de la aplicación y espera 3 segundos a que Word guarde el documento
                      break;
                  }
              }
              Word.Quit();
          }
          return true;
      } catch (e) {
          $OfficeApp.showModal(&quot;No se pudo guardar el documento&quot;, &quot;Error: &quot; + e.message);
          return false;
      }
  };
  </code></pre>
  <hr />
  <h3>Question</h3>
  <p>Any suggestion on how to save document using JavaScript API directly?</p>