Export Html To Word Document With Images Using jQuery Word Export Plugin

File Size: 7.83 KB
Views Total: 104314
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   
Export Html To Word Document With Images Using jQuery Word Export Plugin

Word Export is a small jQuery plugin which allows you to export specific parts of a Html page to a Microsoft Word Doc with images. FileSaver.js is required for saving the word document on the client side using Html5 localStorage.

How to use it:

1. Include the jQuery library 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. Make sure to 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.

jQuery(document).ready(function($) {
  $("a.word-export").click(function(event) {
    $("#page-content").wordExport();
  });
});

Changelog:

2015-02-20

  • removed console log

This awesome jQuery plugin is developed by markswindoll. For more Advanced Usages, please check the demo page or visit the official website.