0
でのdocxファイルからテキストを抽出する方法、私はマンモス私はDOCXファイルからテキストを抽出したいNodejs
var mammoth = require("mammoth");
mammoth.extractRawText({path: "./doc.docx"})
.then(function(result){
var text = result.value; // The raw text
//this prints all the data of docx file
console.log(text);
for (var i = 0; i < text.length; i++) {
//this prints all the data char by char in separate lines
console.log(text[i]);
}
var messages = result.messages;
})
.done();
使用して試してみましたが、ここでの問題は、このforループでは、私が代わりにデータを1行ずつ欲しいということですcharのcharの、ここで私を助けてくださいまたはあなたが知っている他の方法がありますか?
あなたが行ずつ意味していますか? word文書の個々の行や改行で区切られた段落と同様? –
@ExplosionPillsの個々の行が好きです – iwayankit
"\ n"であなたのテキストを分割しています! – tashakori