是否可以在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();