{"hidden":false,"children":[{"configs":{"itemId":"module","serverScript":"//是否下载Excel文件，true下载，false返回HTML\nvar isDownLoad = app.getBool('download');\n//获得基于结果集的数组，使用此方法可以应用键值，DbUtil.getData(rs,'FIELD1=k1,FIELD2=k2','dictTable1,dictTable2');\nvar data = DbUtil.getData(app.run('select * from WB_REPORT_DEMO order by ROW_NUM')); //读取结果集所有记录数据至JSONArray\n//var data = app.getData('select * from WB_REPORT_DEMO order by ROW_NUM').rows;//使用dataprovider生成数据Object\n//var data = Wb.getRecords(app.run('select * from WB_REPORT_DEMO order by ROW_NUM'));//读取结果集所有记录数据至数组对象\nvar reportData = {\n  field1: '某某填报单位',\n  field2: DateUtil.formatDate(new JavaDate()),\n  field3: 'Janice Galvin',\n  field4: 'Rachel Valdez',\n  field5: 'Annette Hill',\n  field6: 'contact@putdb.com',\n  rows: data\n};\nif (isDownLoad) {\n  var excelFilename = 'wb/system/excel/demo/form-report.xlsx',\n    exportFilename = 'report.xlsx',\n    sheetIndex = 1; //-1将使用所有的sheet\n  response.setHeader('content-type', 'application/force-download');\n  response.setHeader('content-disposition', 'attachment;' + WebUtil.encodeFilename(request, exportFilename));\n  Wb.getExcel(reportData, excelFilename, response.getOutputStream(), 1);\n  response.flushBuffer();\n} else {\n  var html = Wb.getHtml(reportData, 'wb/system/excel/demo/form-report.xlsx', 1);\n  app.send(html);\n}"},"expanded":false,"children":[],"type":"module"}],"roles":{"demo":1},"title":"获取数据和报表","iconCls":"","inframe":false,"pageLink":""}