This commit is contained in:
SheetJS 2017-04-19 23:36:29 -04:00
parent 7f86eb6c8a
commit 67de669350
3 changed files with 37 additions and 28 deletions

@ -4,27 +4,20 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>JS-XLSX AJAX Live Demo</title>
<title>SheetJS JS-XLSX AJAX Live Demo</title>
<style>
#drop{
border:2px dashed #bbb;
-moz-border-radius:5px;
-webkit-border-radius:5px;
border-radius:5px;
padding:25px;
text-align:center;
font:20pt bold,"Vollkorn";color:#bbb
}
#b64data{
width:100%;
}
a { text-decoration: none }
</style>
</head>
<body>
<b>JS-XLSX (XLSX/XLSB/XLSM) AJAX Live Demo</b><br />
<a href="https://github.com/SheetJS/js-xlsx">Github Repo</a><br />
<a href="https://github.com/SheetJS/js-xlsx/issues">Issues? Something look weird? Click here and report an issue</a><br />
<pre>
<b><a href="http://sheetjs.com">SheetJS AJAX Live Demo</a></b>
(this demo works back to IE6)
<a href="https://github.com/SheetJS/js-xlsx">Github Repo</a>
<a href="https://github.com/SheetJS/js-xlsx/issues">Issues? Something look weird? Click here and report an issue</a>
<br/><div id="fileurl"></div>
</pre>
<pre id="out"></pre>
<br />
<!-- uncomment the next line here for encoding support -->

@ -18,28 +18,34 @@
#b64data{
width:100%;
}
a { text-decoration: none }
</style>
</head>
<body>
<b>JS-XLSX Live Demo</b><br />
<a href="https://github.com/SheetJS/js-xlsx">Source Code Repo</a><br />
<a href="https://github.com/SheetJS/js-xlsx/issues">Issues? Something look weird? Click here and report an issue</a><br />
Output Format:
<select name="format" onchange="setfmt()">
<pre>
<b><a href="http://sheetjs.com">SheetJS Data Preview Live Demo</a></b>
(Base64 text works back to IE6; drag and drop works back to IE10)
<a href="https://github.com/SheetJS/js-xlsx">Source Code Repo</a>
<a href="https://github.com/SheetJS/js-xlsx/issues">Issues? Something look weird? Click here and report an issue</a>
Output Format: <select name="format" onchange="setfmt()">
<option value="csv" selected> CSV</option>
<option value="json"> JSON</option>
<option value="form"> FORMULAE</option>
<option value="html"> HTML</option>
</select><br />
<div id="drop">Drop a spreadsheet file here to see sheet data</div>
<p><input type="file" name="xlfile" id="xlf" /> ... or click here to select a file</p>
<input type="file" name="xlfile" id="xlf" /> ... or click here to select a file
<textarea id="b64data">... or paste a base64-encoding here</textarea>
<input type="button" id="dotext" value="Click here to process the base64 text" onclick="b64it();"/><br />
Advanced Demo Options: <br />
Use Web Workers: (when available) <input type="checkbox" name="useworker" checked><br />
Use Transferrables: (when available) <input type="checkbox" name="xferable" checked><br />
Use readAsBinaryString: (when available) <input type="checkbox" name="userabs" checked><br />
<b>Advanced Demo Options:</b>
Use Web Workers: (when available) <input type="checkbox" name="useworker" checked>
Use Transferrables: (when available) <input type="checkbox" name="xferable" checked>
Use readAsBinaryString: (when available) <input type="checkbox" name="userabs" checked>
</pre>
<pre id="out"></pre>
<div id="htmlout"></div>
<br />
<script src="shim.js"></script>
<script src="xlsx.full.min.js"></script>
@ -178,6 +184,15 @@ function to_formulae(workbook) {
return result.join("\n");
}
function to_html(workbook) {
document.getElementById('htmlout').innerHTML = "";
var result = [];
workbook.SheetNames.forEach(function(sheetName) {
var htmlstr = X.write(workbook, {sheet:sheetName, type:'binary', bookType:'html'});
document.getElementById('htmlout').innerHTML += htmlstr;
});
}
var tarea = document.getElementById('b64data');
function b64it() {
if(typeof console !== 'undefined') console.log("onload", new Date());
@ -196,6 +211,7 @@ function process_wb(wb) {
case "form":
output = to_formulae(wb);
break;
case "html": return to_html(wb);
default:
output = to_csv(wb);
}

@ -13,7 +13,7 @@
</style>
</head>
<body>
<h1 id="t">JS-XLSX Browser-based Parsing Tests</h1>
<h1 id="t"><a href="http://sheetjs.com">JS-XLSX Browser-based Parsing Tests</a></h1>
<table id="tt">
<tr>
<th>File Formats</th>