From 4d71d4db09a82095b3c4864c2cb9af2c5f144e1f Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Wed, 25 Oct 2017 15:36:45 -0400 Subject: [PATCH] add export functionality --- composer.json | 5 ++++ composer.lock | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++ export.php | 16 +++++++++++ index.html | 15 ++++++++--- 4 files changed, 107 insertions(+), 4 deletions(-) create mode 100644 composer.json create mode 100644 composer.lock create mode 100644 export.php diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..4ccdc06 --- /dev/null +++ b/composer.json @@ -0,0 +1,5 @@ +{ + "require": { + "phpoffice/phpexcel": "^1.8" + } +} diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..109be1e --- /dev/null +++ b/composer.lock @@ -0,0 +1,75 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "This file is @generated automatically" + ], + "content-hash": "50489714dc35b8c5a19828e5fdb18e98", + "packages": [ + { + "name": "phpoffice/phpexcel", + "version": "1.8.1", + "source": { + "type": "git", + "url": "https://github.com/PHPOffice/PHPExcel.git", + "reference": "372c7cbb695a6f6f1e62649381aeaa37e7e70b32" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPOffice/PHPExcel/zipball/372c7cbb695a6f6f1e62649381aeaa37e7e70b32", + "reference": "372c7cbb695a6f6f1e62649381aeaa37e7e70b32", + "shasum": "" + }, + "require": { + "ext-xml": "*", + "ext-xmlwriter": "*", + "php": ">=5.2.0" + }, + "type": "library", + "autoload": { + "psr-0": { + "PHPExcel": "Classes/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL" + ], + "authors": [ + { + "name": "Maarten Balliauw", + "homepage": "http://blog.maartenballiauw.be" + }, + { + "name": "Mark Baker" + }, + { + "name": "Franck Lefevre", + "homepage": "http://blog.rootslabs.net" + }, + { + "name": "Erik Tilt" + } + ], + "description": "PHPExcel - OpenXML - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine", + "homepage": "http://phpexcel.codeplex.com", + "keywords": [ + "OpenXML", + "excel", + "php", + "spreadsheet", + "xls", + "xlsx" + ], + "time": "2015-05-01T07:00:55+00:00" + } + ], + "packages-dev": [], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": [], + "platform-dev": [] +} diff --git a/export.php b/export.php new file mode 100644 index 0000000..21b29a9 --- /dev/null +++ b/export.php @@ -0,0 +1,16 @@ +getActiveSheet()->fromArray(array_chunk($cases, 1), NULL, 'B2'); + +header('Content-Type: application/vnd.ms-excel'); +header('Content-Disposition: attachment;filename="testcase-template.xls"'); +header('Cache-Control: max-age=0'); +$writer = PHPExcel_IOFactory::createWriter($excel, 'Excel5'); +$writer->save('php://output'); + diff --git a/index.html b/index.html index d37e61e..4e06dd9 100755 --- a/index.html +++ b/index.html @@ -40,8 +40,15 @@
+
+
+

{{ combos.length }} {{ pluralize("test case", combos.length) }}

-
{{ combos.join('\n') }}
+ +
+ + +
@@ -71,9 +78,9 @@ var vm = new Vue({ el: '#app', data: { - prefix: "* ", - delimiter: " \\\\ ", - suffix: " \\\\ \\\\", + prefix: "", + delimiter: " ", + suffix: "", n: "# Country\nDTUS\nDTCAN\n\n# Routing number\nValid routing number\nInvalid routing number\n\n# Service call\nIncluded in service call\nNot included in service call\n\n# Payment type/source\nOne time (Payment Central)\nPay plan (Pay Plan Maintenance Screen)\nScan/Import Screen" }, methods: {