1

I'm trying to use jQuery Load() function for reading word document(docx) content and set it between paragraph tags of body in html document. But there is a problem with character encoding as in picture below.

enter image description here My script:

<script>
    function loadworddoc() {

       $("#textHolder").load("Licence/licence.docx");
    }
</script>

HTML:

<p id="textHolder"></p>
<a href="#" onclick="javascript:loadworddoc()">Load</a> 

How can I solve it?

Any answers will be appreciated!

Husni Salax
  • 1,968
  • 1
  • 19
  • 29
  • Possible duplicate of [jQuery load(function) for a Microsoft Word Document](https://stackoverflow.com/questions/22822542/jquery-loadfunction-for-a-microsoft-word-document) – showdev Jan 26 '18 at 20:35
  • @showdev my question about encoding for jQuery Load function, In your mentioned link not writing about it :( – Husni Salax Jan 26 '18 at 20:49
  • The post I referenced describes why using jQuery to load a Word document will not work as you expect. You'll need a way to parse the file. See [How to display a word document using fancybox](https://stackoverflow.com/questions/9418850/how-to-display-a-word-document-using-fancybox) ; [get docx file contents using javascript/jquery](https://stackoverflow.com/questions/28440170/get-docx-file-contents-using-javascript-jquery) ; [How to convert/read word file using jquery/ajax](https://stackoverflow.com/questions/10083277/how-to-convert-read-word-file-using-jquery-ajax). – showdev Jan 26 '18 at 20:56

1 Answers1

0

Instead of jQuery Load() function for reading word document(docx) or other formats (pdf) I use fancybox.jquery.

Husni Salax
  • 1,968
  • 1
  • 19
  • 29