{"id":24408,"date":"2016-12-09T16:05:44","date_gmt":"2016-12-09T15:05:44","guid":{"rendered":"http:\/\/help.qualiware.it\/qw-help\/?p=24408"},"modified":"2016-12-09T16:05:44","modified_gmt":"2016-12-09T15:05:44","slug":"esportazione-di-una-griglia-in-excel","status":"publish","type":"post","link":"https:\/\/help.qualiware.it\/qw-help\/esportazione-di-una-griglia-in-excel\/","title":{"rendered":"Esportazione di una griglia in Excel"},"content":{"rendered":"<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\">' Il seguente frammento esporta la griglia contenuta nell'oggetto \"FILIERA\" all'interno di un template EXCEL contenuto nella cartella rpt_custom.\r\n\r\ndim dati as new dbarray\r\ndim riga as dbarray\r\ndim i as integer\r\n\r\nform.findcontrol(\"FILIERA\").MoveFirst()\r\nfor i=1 to form.findcontrol(\"FILIERA\").Count()\r\n ' Crea la riga a partire dalla griglia \r\n riga=new dbarray()\r\n riga.add(form.findcontrol(\"FILIERA\").ReadField(\"NUMBER1\"))\r\n riga.add(form.findcontrol(\"FILIERA\").ReadField(\"CUSTOM9\"))\r\n riga.add(form.findcontrol(\"FILIERA\").ReadField(\"CUSTOM8\"))\r\n riga.add(form.findcontrol(\"FILIERA\").ReadField(\"CUSTOM1\"))\r\n riga.add(form.findcontrol(\"FILIERA\").ReadField(\"CUSTOM2\"))\r\n riga.add(form.findcontrol(\"FILIERA\").ReadField(\"CUSTOM13\"))\r\n riga.add(form.findcontrol(\"FILIERA\").ReadField(\"CUSTOM3\"))\r\n riga.add(form.findcontrol(\"FILIERA\").ReadField(\"CUSTOM4\"))\r\n riga.add(form.findcontrol(\"FILIERA\").ReadField(\"CUSTOM5\"))\r\n riga.add(form.findcontrol(\"FILIERA\").ReadField(\"CUSTOM6\"))\r\n riga.add(form.findcontrol(\"FILIERA\").ReadField(\"CUSTOM7\"))\r\n riga.add(iif(form.findcontrol(\"FILIERA\").ReadField(\"FLAG1\"),\"S\u00ec\",\"No\"))\r\n riga.add(form.findcontrol(\"FILIERA\").ReadField(\"CUSTOM10\"))\r\n riga.add(form.findcontrol(\"FILIERA\").ReadField(\"CUSTOM12\"))\r\n riga.add(form.findcontrol(\"FILIERA\").ReadField(\"CUSTOM11\"))\r\n \r\n dati.add(riga)\r\n \r\n form.findcontrol(\"FILIERA\").MoveNext()\r\nnext\r\nform.findcontrol(\"FILIERA\").MoveFirst()\r\n\r\ndim nome_file as string=PrintExcel(form.page,\"TEMPLATE_FILIERA.XLSX\",dati,true) ' L'ultimo parametro se false attiva automaticamente la procedura di scaricamento del file, se true fa ritornare il nome del file e la procedura deve essere inserita esplicamente, come riportato qui sotto\r\n\r\nif nome_file&lt;&gt;\"\"\r\n Dim url as string= CreateDownloadRequest(form.page, nome_file,true,\"Filiera \"+Sane_Filename(form.findcontrol(\"RAGSOC\").value)+\".XLSX\")\r\n BrowserDo(form,url)\r\nend if<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>&#8216; Il seguente frammento esporta la griglia contenuta nell&#8217;oggetto &#8220;FILIERA&#8221; all&#8217;interno di un template EXCEL contenuto nella cartella rpt_custom. dim dati as new dbarray dim riga as dbarray dim i as integer form.findcontrol(&#8220;FILIERA&#8221;).MoveFirst() for i=1 to form.findcontrol(&#8220;FILIERA&#8221;).Count() &#8216; Crea la riga a partire dalla griglia riga=new dbarray() riga.add(form.findcontrol(&#8220;FILIERA&#8221;).ReadField(&#8220;NUMBER1&#8221;)) riga.add(form.findcontrol(&#8220;FILIERA&#8221;).ReadField(&#8220;CUSTOM9&#8221;)) riga.add(form.findcontrol(&#8220;FILIERA&#8221;).ReadField(&#8220;CUSTOM8&#8221;)) riga.add(form.findcontrol(&#8220;FILIERA&#8221;).ReadField(&#8220;CUSTOM1&#8221;)) riga.add(form.findcontrol(&#8220;FILIERA&#8221;).ReadField(&#8220;CUSTOM2&#8221;)) riga.add(form.findcontrol(&#8220;FILIERA&#8221;).ReadField(&#8220;CUSTOM13&#8221;)) riga.add(form.findcontrol(&#8220;FILIERA&#8221;).ReadField(&#8220;CUSTOM3&#8221;)) riga.add(form.findcontrol(&#8220;FILIERA&#8221;).ReadField(&#8220;CUSTOM4&#8221;))&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"ngg_post_thumbnail":0,"footnotes":""},"categories":[65],"tags":[71],"acf":[],"_links":{"self":[{"href":"https:\/\/help.qualiware.it\/qw-help\/wp-json\/wp\/v2\/posts\/24408"}],"collection":[{"href":"https:\/\/help.qualiware.it\/qw-help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/help.qualiware.it\/qw-help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/help.qualiware.it\/qw-help\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/help.qualiware.it\/qw-help\/wp-json\/wp\/v2\/comments?post=24408"}],"version-history":[{"count":0,"href":"https:\/\/help.qualiware.it\/qw-help\/wp-json\/wp\/v2\/posts\/24408\/revisions"}],"wp:attachment":[{"href":"https:\/\/help.qualiware.it\/qw-help\/wp-json\/wp\/v2\/media?parent=24408"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/help.qualiware.it\/qw-help\/wp-json\/wp\/v2\/categories?post=24408"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/help.qualiware.it\/qw-help\/wp-json\/wp\/v2\/tags?post=24408"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}