JavaScript library to read doc and docx on client

前端 未结 2 1047
失恋的感觉
失恋的感觉 2021-01-20 22:05

I am searching for a JavaScript library, which can read .doc - and .docx - files. The focus is only on the text content. I am not interested in pic

2条回答
  •  我在风中等你
    2021-01-20 22:49

    You can use docxtemplater for this (even if normally, it is used for templating, it can also just get the text of the document) :

    var zip = new JSZip(content);
    var doc=new Docxtemplater().loadZip(zip)
    var text= doc.getFullText();
    console.log(text);
    

    See the Doc for installation information (I'm the maintainer of this project)

    However, it only handles docx, not doc

提交回复
热议问题