[MS Word] A jQuery Plugin That Allows an HTML Page To Be Converted | googoose

Googose allows you to convert any HTML content page into a properly formatted Microsoft Word (.doc) file.

Googoose is a jquery plugin that allows converting an HTML page and/or downloading it to an MS Word document with an eye on performance.

Benefits:

  • You now have the ability to view rich web content.
  • You can create Word documents programmatically without much work, using a third-party library, etc.
  • You can directly integrate this into sites using WYSIWYG editors (ex: WordPress). There is no need to install a plugin.

How to make use of it:

1. Load the required JavaScript libraries within the webpage.

<script src="/path/to/jquery.min.js"></script>
<script src="/path/to/FileSaver.js"></script>

2. Make certain the jQuery Googoose plugin is loaded after jQuery:

<script src="jquery.googoose.js"></script>

3. Add the CSS class ‘googoose’ to HTML content.

<div class="googoose">
  ..
</div>

4. Call the googoose function to save lots of your web page as an MS word on web page load.

$(document).googoose();

5. Full customization choices.

$(document).googoose({

  // default selector of html to wrap the Word doc in
  area: 'div.googoose',

  // used to manufacture headers and footers
  headerfooterid: 'googoose-hdrftrtbl',

  // CSS origins of the Word document
  margins: '1.0in',

  // zoom percentage when the Word document opens
  zoom: '75',

  // the file name to save as
  filename: 'Doc1_' + now + '.doc',

  // size of the Word document
  size: '8.5in 11.0in',

  // display mode to open the Word document in
  display: 'Print',

  //  the language on the page
  lang: 'en-US',

  // determines whether the page should be downloaded as a Word document or displayed as HTML
  download: true,

  // if used by the developer this jQuery selector will translate into a Word table of contents
  toc: 'div.googoose.toc',

  // f used by the developer at this jQuery selector will translate into a Microsoft Word page break
  pagebreak: 'div.googoose.break',

  // the content in this jQuery selector will be put in the Microsoft Word document header
  headerarea: 'div.googoose.header',

  // the content in this jQuery selector will be put in the document footer
  footerarea: 'div.googoose.footer',

  // used solely by the googoose internals
  headerid: 'googoose-header',

  // used solely by the googoose internals
  footerid: 'googoose-footer',

  // CSS margin for the header
  headermargin: '.5in',

  // CSS margin for the footer
  footermargin: '.5in',

  //  generally used in headers and Footers this whole display the current page number
  currentpage: 'span.googoose.currentpage',

  // generally displayed in headers and Footers this jQuery selector when put into the HTML content will display the number of total pages.
  totalpage: 'span.googoose.totalpage',

  // html boundary
  htmlboundary: '--',

  // called after the HTML has been rendered
  finishaction: GG.finish,

  // the root node
  initobj: document
});

Options

  • area: ‘div.googoose-wrapper’ – This is the default selector of HTML to wrap the Word doc in.
  • headerfooterid: ‘googoose-hdrftrtbl’ – This is used by the internals of googoose to manufacture headers and footers.
  • margins: ‘1.0in’ – the default CSS origins of the Word document.
  • zoom: ’75’ – the default Zoom percentage when the Word document opens.
  • filename: null – the file name to save as. used only by the default finish action.
  • size: ‘8.5in 11.0in’ – the default size of the Word document.
  • display: ‘Print’ – the default display mode to open the Word document in.
  • lang: ‘en-US’ – the language on the page. defaults to English US.
  • toc: ‘div.good goose.toc’ if used by the developer this jQuery selector will translate into a Word table of contents.
  • pagebreak: ‘div.googoose.break’ – if used by the developer at this jQuery selector will translate into a Microsoft Word page break.
  • headerarea: ‘div.googoose.header’ – the content in this jQuery selector will be put in the Microsoft Word document header.
  • footerarea: ‘div.googoose.footer’ – the content in this jQuery selector will be put in the document footer.
  • headerid: ‘googoose-header’ – used solely by the googoose internals
  • footerid: ‘googoose-footer’ – used solely by the googoose internals
  • headermargin: ‘.5in’ – CSS margin for the header.
  • footermargin: ‘.5in’ – the CSS margin for the footer.
  • currentpage: ‘span.googoose.currentpage’ – generally used in headers and Footers this whole displays the current page number.
  • totalpage: ‘span.googoose.totalpage’ – generally displayed in headers and Footers this jQuery selector when put into the HTML content will display the number of total pages.
  • finishaction: GG.finish – this is the default action that is called after the HTML has been rendered.
  • html: null – gets populated before finishaction
  • initobj: document – the root node

jQuery Plugin To Save Webpage As MS Word Document, googoose Plugin/Github


See Demo And Download

Official Website(aadel112): Click Here

This superior jQuery/javascript plugin is developed by aadel112. For extra Advanced Usage, please go to the official website.

Share