-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathload-app.js
53 lines (48 loc) · 1.37 KB
/
load-app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import show_error from './show-error.mjs';
import './dist/app.js';
import './src/sheet_element.js';
async function init_app() {
const compilation_error = await show_error;
if(compilation_error) {
return;
}
const main = document.body.querySelector('main');
main.innerHTML = '';
const spreadsheet = document.createElement('spread-sheet');
spreadsheet.setAttribute('disabled',false);
main.appendChild(spreadsheet);
spreadsheet.addEventListener('sheetchange', e => {
const {sheet} = e.detail;
console.log(sheet.A2);
});
const d = await (await fetch('examples/books-per-child.xlsx')).arrayBuffer();
const wb = XLSX.read(d, {sheetStubs:true, cellNF: true});
wb.Sheets.Sheet1.A2.style = {
border: {
left: {
style: 'thick',
color: {css: 'red'}
}
},
font: {
name: 'sans-serif',
sz: 22,
color: 'blue',
bold: true,
italic: true,
underline: true
},
fill: {
fgColor: {css: 'blue'}
},
alignment: {
horizontal: 'left',
vertical: 'top'
}
};
wb.Sheets.Sheet1.A2.disabled = true;
console.log(wb);
const sheet = Object.values(wb['Sheets'])[0];
spreadsheet.load_worksheet(sheet)
}
init_app();