Hi Harjo,
Tnx for the reply. I have tried 2 things but only got errors.
1 .
I have tried the writeFile method
writeFile(‘report.docx’, plugins.it2be-word.documentobject)
I got the following error.
Can’t find method com.servoy.extensions.plugins.file.WebFileProvider.js_writeFile(string,com.it2be.word.IWDocument,string).
When I let the it2be plugin save the document first to
var _savelocation = ‘…/application_server/w_docs/report.docx’;
_document.save( _savelocation);
Then I added a download button with the following code:
var _pathto = “…/application_server/w_docs/”;
var _repname = ‘report.docx’;
var _reportfilename = _pathto + _repname;
var _f = plugins.file.convertToJSFile(_reportfilename)
if(_f && _f.canRead()){
plugins.file.writeFile(‘report.docx’, _f , ‘application/vnd.openxmlformats-officedocument.wordprocessingml.document’)
} else {
application.output(‘cant read file’)
}
I mixed up that the file wasnt read as bytes. Instead of making a byte array.
Tnx for the advice
Working code example:
var bytes = new Array();
for (var i=0; i<10240; i++)
bytes = i % 100; var _pathto = “…/application_server/w_docs/”; var _repname = ‘report.docx’; var _reportfilename = _pathto + _repname; var _f = plugins.file.convertToJSFile(_reportfilename) if(_f && _f.canRead()){