Hi all,
I have an export (dataset) what I convert into HTML like dataset.getValue(1,1) etc etc
This all works fine, but because I dont use bytes I use the plugins.file.writeTXTFile method, to write the HTML as text.
code…
var _fname = ‘filename.xls’;
var _file = plugins.file.convertToJSFile(_dir + ‘\’ + _fname);
var _mime = ‘application/vnd.ms-excel’;
var _mimetype = ‘application/vnd.openxmlformats-officedocument.spreadsheetml.sheet’;
var _file = plugins.file.convertToJSFile( _fname);
if( _file ) {
var _filename = _file.getAbsoluteFile();
if( plugins.file.writeTXTFile(_file, _data, ‘utf-8’, _mimetype)) {
var _b = plugins.file.readFile( _file )
var _f = plugins.file.convertToJSFile( _file )
if(_f && _f.canRead()){
plugins.file.writeFile(_filename, _b, _mimetype );
scopes.synchronize.openExcelFile(_file)
}
}
}
2 problems:
-
When using the XLS extension with vnd.ms-excel mimetype I get an corrupted file error and can choose open the file or not (when opening Excel
When using XLSX with vnd.openxmlformats-officedocument.spreadsheetml.sheet this option gives me an corrupted file error with no continue options (when opening Excle) -
When use this code in Developer it opens Excel nicely. But running from the server it does nothing, doesnt even give me an error in log.
The nice part is that I have an excel export with almost the same code, doing just fine. The only difference is the HTML and plugins.file.writeTXTFile
Code for running excel
application.executeProgram(“rundll32”, “url.dll,FileProtocolHandler”, _file);
Can someone help me to fix these problems?
Thanks
Derk