AnsweredAssumed Answered

Export Record to Excel

Question asked by ChristofferRexen_1 on Dec 22, 2016
Latest reply on Dec 22, 2016 by user19752

Hello everyone,

 

Happy holidays!

 

Currently sitting and battling with a database, since our customer wants to export records via WebDirect.

Now, since WebDirect does not support the script step "Export Records to Excel" i knew I had to come up with something smart.

 

I googled my way around, and found a potentiel solution, although I can't seem to get it working.

Filemaker WebDirect Excel export - YouTube

There is even a link to the solution, which holds the solution.

http://filemakerturk.com/1311/webdirect-excel-export-dosyas%C4%B1-deneye-bilir-misiniz

- Note, it's Turkish.

 

Now, I copied the content to my own solution, and actually got as far as seeing my data being aligned as if it were an actual Excel alignment, although I am not allowed to Download/Export to Excel as shown in the movie, either sitting on my Desktop in FileMaker Pro Advanced 15 or trying via WebDirect through Google Chrome.

 

"data:text/html,<html xmlns=\"http://www.w3.org/1999/xhtml\">¶

<head runat=\"server\">¶

    ¶

    <script Language=\"javascript\">¶

        function TableToExcel() {¶

            var strCopy = document.getElementById(\"detailsTable\").innerHTML;¶

            window.clipboardData.setData(\"Text\", strCopy);¶

            var objExcel = new ActiveXObject(\"Excel.Application\");¶

            objExcel.visible = true;¶

            var objWorkbook = objExcel.Workbooks.Add;¶

            var objWorksheet = objWorkbook.Worksheets(1);¶

            objWorksheet.Paste;¶

        }¶

        function exportToExcel() {¶

            var oExcel = new ActiveXObject(\"Excel.Application\");¶

            var oBook = oExcel.Workbooks.Add;¶

            var oSheet = oBook.Worksheets(1);¶

            for (var y = 0; y < detailsTable.rows.length; y++)¶

            // detailsTable is the table where the content to be exported is¶

            {¶

                for (var x = 0; x < detailsTable.rows(y).cells.length; x++) {¶

                    oSheet.Cells(y + 1, x + 1) = detailsTable.rows(y).cells(x).innerText;¶

                }¶

            }¶

            oExcel.Visible = true;¶

            oExcel.UserControl = true;¶

        }¶

    </script>¶

    <title></title>¶

</head>¶

<body>¶" &

$$Kod &

   "¶ </span>¶

      <a href=\"javascript:exportToExcel();\">Eksporter til Excel</a><br/>¶

</body>¶

</html>"

 

Am I missing something in my solution?

Best regards

Christoffer

Outcomes