HTML Format Covert To Word Document In jQuery – jQuery Word Export

File Size:6.84 KB
Views Total:1,956
Last Update:May 23, 2018
Publish Date:December 2, 2017
Official Website:Go to website
License:MIT

In jQuery plugin Word, Export helps you to export some of the specific parts of the HTML page to the Microsoft Word Document with the full images. For saving the word document on the side of the client FileSaver.js is mandatory to be there by using the HTML5 local storage.

How to use it:

  1. Include the jQuery and filesaver.js at the bottom of the Html page.
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
    <script src="FileSaver.js"></script>
  2.  Include the word export plugin after jQuery library and filesaver.js.
    <script src="jquery.wordexport.js"></script>

     

  3.  Wrap the content you want to export to a Word document in a container.
    <div id="export-content">
    
    Your content here
    
    </div>

     

  4.  Create a link to save and export the content as .doc.
    <a class="word-export" href="javascript:void(0)"> Export as .doc </a>

     

  5.  The javascript to initialize the plugin.
    <script type="text/javascript">
    jQuery(document).ready(function($) {
    $("a.word-export").click(function(event) {
    $("#page-content").wordExport();
    });
    });
    </script>

    Done 🙂