0
DOCXファイルは基本的にXMLファイルでいっぱいです。 chrome.fileSystemストレージAPIを使用してDOCXファイルを保存する簡単な方法はありますか、または手動でXMLファイルを作成してパッケージ化する必要がありますか?Chrome App Javascript:テキストをDOCXファイルとして保存する
chrome.fileSystem.chooseEntry({
type: 'saveFile',
accepts: [
{ extensions: ['docx'] },
{ extensions: ['txt'] },
]
}, function(writableFileEntry) {
var ext = writableFileEntry.name.substr(writableFileEntry.name.lastIndexOf('.') + 1);
var text = document.getElementById("textarea").innerText;
if(ext == 'docx'){
... ?
}
else if(ext == 'txt'){
writableFileEntry.createWriter(function(writer) {
writer.write(new Blob([text], {type: 'text/plain'}));
}, function(){
window.alert('Saving file failed');
});
}
});