add export functionality
This commit is contained in:
parent
5f73af30eb
commit
4d71d4db09
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"require": {
|
||||||
|
"phpoffice/phpexcel": "^1.8"
|
||||||
|
}
|
||||||
|
}
|
|
@ -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": []
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
require_once __DIR__ . "/vendor/autoload.php";
|
||||||
|
|
||||||
|
|
||||||
|
$excel = PHPExcel_IOFactory::load("export.xlsx");
|
||||||
|
|
||||||
|
$cases = explode("\n", $_POST["test_cases"]);
|
||||||
|
$excel->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');
|
||||||
|
|
15
index.html
15
index.html
|
@ -40,8 +40,15 @@
|
||||||
<div class="control"><textarea style="font-family:monospace; resize:vertical;" rows="20" v-model="n" class="textarea"></textarea></div>
|
<div class="control"><textarea style="font-family:monospace; resize:vertical;" rows="20" v-model="n" class="textarea"></textarea></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
<hr>
|
||||||
|
|
||||||
<p v-cloak><strong>{{ combos.length }}</strong> {{ pluralize("test case", combos.length) }}</p>
|
<p v-cloak><strong>{{ combos.length }}</strong> {{ pluralize("test case", combos.length) }}</p>
|
||||||
<pre v-cloak>{{ combos.join('\n') }}</pre>
|
|
||||||
|
<form action="export.php" method="POST">
|
||||||
|
<textarea v-cloak name="test_cases" style="font-family:monospace; resize:vertical;" rows="30" class="textarea">{{ combos.join('\n') }}</textarea>
|
||||||
|
<button type="submit">export to excel template</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
@ -71,9 +78,9 @@
|
||||||
var vm = new Vue({
|
var vm = new Vue({
|
||||||
el: '#app',
|
el: '#app',
|
||||||
data: {
|
data: {
|
||||||
prefix: "* ",
|
prefix: "",
|
||||||
delimiter: " \\\\ ",
|
delimiter: " ",
|
||||||
suffix: " \\\\ \\\\",
|
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"
|
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: {
|
methods: {
|
||||||
|
|
Loading…
Reference in New Issue