excel export with servoyguy_servoycom

Using Servoy to administrate the content of your website? Discuss all webrelated Servoy topics on this forum!

excel export with servoyguy_servoycom

Postby winnie » Thu Jan 23, 2014 2:46 pm

we are trying to export Data into Excel using the servoyguy_servoycom - Plugin with the following function:

Code: Select all
function onExcelExportTest(event) {
   /**@type {Packages.com.servoyguy.servoycom.JSCOM}*/
   var _excelObject;
   /**@type {Packages.com.servoyguy.servoycom.JSCOM}*/
   var _workBooks;
   /**@type {Packages.com.servoyguy.servoycom.JSCOM}*/
   var _workSheet;
   /**@type {String}*/
   var _fileName;
   /**@type {Array<java.lang.Object>}*/
   var _object;

   if(!plugins.servoyguy_servoycom.isJACOBInstalled()) {
      globals.DIALOGS.showErrorDialog('Excel export error', 'plugins.servoyguy_servoycom.isJACOBInstalled()', 'OK');

   // excel com-object
   _excelObject = plugins.servoyguy_servoycom.getNewClientJSCOM("excel.application");
   if(!_excelObject) {
      globals.DIALOGS.showErrorDialog('Excel export error', 'plugins.servoyguy_servoycom.getNewClientJSCOM("excel.application")', 'OK');

   // create workbook
   _workBooks = _excelObject.getChildJSCOM("WorkBooks");
   // add worksheet
   _object = [1];
   _workSheet = _excelObject.getChildJSCOM("WorkSheets", _object);

   // save
   _fileName = "gde_exceltest";

   try {
      var x1 = _workSheet.call("SaveAs", _fileName); 
      var x2 = _workSheet.call("SaveAs", "c:\\temp\\" + _fileName);
      var x3 = _workSheet.call("SaveAs", "f:\\" + _fileName);
      var x4 = _workSheet.call("SaveAs", plugins.file.getDefaultUploadLocation() + "\\" + _fileName); 
   } catch (error) {
      globals.DIALOGS.showErrorDialog('Excel export error', '_workSheet.call("SaveAs", _fileName)', 'OK');
   globals.DIALOGS.showErrorDialog('Excel export', 'Fertig, x1=' + x1 + ', x2=' + x2 + ', x3=' + x3 + ', x4=' + x4, 'OK');

Testing it in the developer works fine. But on the Application Server it seems, that the command '_workSheet.call("SaveAs", ...)' doesn't work. There is no error occuring in the serverlog or anywhere else.
Does anyone have any idea how to solve this problem?

Thank you for your answers.

Posts: 14
Joined: Thu Jul 07, 2011 6:41 pm

Return to Web Development

Who is online

Users browsing this forum: No registered users and 1 guest