是否可以在 JavaScript 中创建 .doc 格式的文件?
目前我有一个 Mozilla 插件,它可以创建 .txt 文件,但很想知道它是否可以扩展到 .doc ..
file = Components.classes["@mozilla.org/file/local;1"]
.createInstance(Components.interfaces.nsILocalFile);
file.initWithPath(fullPathToFile);
if (file.exists() === false)
{file.create(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 420);}
var outputStream = Components.classes["@mozilla.org/network/file-output-stream;1"]
.createInstance(Components.interfaces.nsIFileOutputStream),
converter = Components.classes["@mozilla.org/intl/converter-output-stream;1"]
.createInstance(Components.interfaces.nsIConverterOutputStream);
outputStream.init(file, 0x02 | 0x08 | 0x20, 420, 0);
converter.init(outputStream, "UTF-8", 0, 0);
converter.writeString('\n --------------------------------------------------- \n');
converter.close();