Spreadsheet Layout
Examples
Change the visual style
Currently, there are two native layouts: the default
and the modern
. The latter can be selected by adding the jss_modern
class to the spreadsheet DIV container.
<html>
<script src="https://jspreadsheet.com/v10/jspreadsheet.js"></script>
<script src="https://jsuites.net/v5/jsuites.js"></script>
<link rel="stylesheet" href="https://jspreadsheet.com/v10/jspreadsheet.css" type="text/css" />
<link rel="stylesheet" href="https://jsuites.net/v5/jsuites.css" type="text/css" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Material+Icons" />
<div id="jspreadsheet"></div>
<script>
let toggle = function() {
if (document.getElementById('jspreadsheet').classList.contains('jss_modern')) {
document.getElementById('jspreadsheet').classList.remove('jss_modern');
} else {
document.getElementById('jspreadsheet').classList.add('jss_modern');
}
}
// Set your JSS license key (The following key only works for one day)
jspreadsheet.setLicense('YWJkMTkzNmMwNzhhM2E0MTVkY2I1M2Y2ZGZiMWE5YmYyMDIxNTc3MDdjYjMyZTdmM2MyMzA1Y2QzYmZkNTA1YzhlMDgzYmViZmJmNTExNjU3MjJjMTNiOTIxNDAxMjc4YjA4ZmJlYWQzZmU2Y2JlNDU2YzI4MzU4NmJjMzg2NGUsZXlKamJHbGxiblJKWkNJNklpSXNJbTVoYldVaU9pSktjM0J5WldGa2MyaGxaWFFpTENKa1lYUmxJam94TnpNeU1qWTJPRE14TENKa2IyMWhhVzRpT2xzaWFuTndjbVZoWkhOb1pXVjBMbU52YlNJc0ltTnZaR1Z6WVc1a1ltOTRMbWx2SWl3aWFuTm9aV3hzTG01bGRDSXNJbU56WWk1aGNIQWlMQ0ozWldJaUxDSnNiMk5oYkdodmMzUWlYU3dpY0d4aGJpSTZJak0wSWl3aWMyTnZjR1VpT2xzaWRqY2lMQ0oyT0NJc0luWTVJaXdpZGpFd0lpd2lkakV4SWl3aVkyaGhjblJ6SWl3aVptOXliWE1pTENKbWIzSnRkV3hoSWl3aWNHRnljMlZ5SWl3aWNtVnVaR1Z5SWl3aVkyOXRiV1Z1ZEhNaUxDSnBiWEJ2Y25SbGNpSXNJbUpoY2lJc0luWmhiR2xrWVhScGIyNXpJaXdpYzJWaGNtTm9JaXdpY0hKcGJuUWlMQ0p6YUdWbGRITWlMQ0pqYkdsbGJuUWlMQ0p6WlhKMlpYSWlMQ0p6YUdGd1pYTWlYU3dpWkdWdGJ5STZkSEoxWlgwPQ==');
jspreadsheet(document.getElementById('jspreadsheet'), {
worksheets: [
{ minDimensions: [10,10] },
]
});
document.getElementById("togglebtn").onclick = toggle
</script>
<button type="button" id="togglebtn">Toggle skin </button>
</html>
import React, { useRef } from "react";
import { Spreadsheet, Worksheet } from "@jspreadsheet/react";
const license = 'YWJkMTkzNmMwNzhhM2E0MTVkY2I1M2Y2ZGZiMWE5YmYyMDIxNTc3MDdjYjMyZTdmM2MyMzA1Y2QzYmZkNTA1YzhlMDgzYmViZmJmNTExNjU3MjJjMTNiOTIxNDAxMjc4YjA4ZmJlYWQzZmU2Y2JlNDU2YzI4MzU4NmJjMzg2NGUsZXlKamJHbGxiblJKWkNJNklpSXNJbTVoYldVaU9pSktjM0J5WldGa2MyaGxaWFFpTENKa1lYUmxJam94TnpNeU1qWTJPRE14TENKa2IyMWhhVzRpT2xzaWFuTndjbVZoWkhOb1pXVjBMbU52YlNJc0ltTnZaR1Z6WVc1a1ltOTRMbWx2SWl3aWFuTm9aV3hzTG01bGRDSXNJbU56WWk1aGNIQWlMQ0ozWldJaUxDSnNiMk5oYkdodmMzUWlYU3dpY0d4aGJpSTZJak0wSWl3aWMyTnZjR1VpT2xzaWRqY2lMQ0oyT0NJc0luWTVJaXdpZGpFd0lpd2lkakV4SWl3aVkyaGhjblJ6SWl3aVptOXliWE1pTENKbWIzSnRkV3hoSWl3aWNHRnljMlZ5SWl3aWNtVnVaR1Z5SWl3aVkyOXRiV1Z1ZEhNaUxDSnBiWEJ2Y25SbGNpSXNJbUpoY2lJc0luWmhiR2xrWVhScGIyNXpJaXdpYzJWaGNtTm9JaXdpY0hKcGJuUWlMQ0p6YUdWbGRITWlMQ0pqYkdsbGJuUWlMQ0p6WlhKMlpYSWlMQ0p6YUdGd1pYTWlYU3dpWkdWdGJ5STZkSEoxWlgwPQ==';
const toggle = function() {
if (document.getElementById('spreadsheet').classList.contains('jss_modern')) {
document.getElementById('spreadsheet').classList.remove('jss_modern');
} else {
document.getElementById('spreadsheet').classList.add('jss_modern');
}
}
export default function App() {
// Spreadsheet array of worksheets
const spreadsheet = useRef();
// Render component
return (
<>
<Spreadsheet ref={spreadsheet} license={license}>
<Worksheet />
</Spreadsheet>
<button type="button" onClick={() => toggle()}>Toggle</button>
</>
);
}
<template>
<Spreadsheet ref="spreadsheet" :license="license">
<Worksheet />
</Spreadsheet>
<button type="button" @click="toggle">Toggle</button>
</template>
<script>
import { Spreadsheet, Worksheet } from "@jspreadsheet/vue";
const license = 'YWJkMTkzNmMwNzhhM2E0MTVkY2I1M2Y2ZGZiMWE5YmYyMDIxNTc3MDdjYjMyZTdmM2MyMzA1Y2QzYmZkNTA1YzhlMDgzYmViZmJmNTExNjU3MjJjMTNiOTIxNDAxMjc4YjA4ZmJlYWQzZmU2Y2JlNDU2YzI4MzU4NmJjMzg2NGUsZXlKamJHbGxiblJKWkNJNklpSXNJbTVoYldVaU9pSktjM0J5WldGa2MyaGxaWFFpTENKa1lYUmxJam94TnpNeU1qWTJPRE14TENKa2IyMWhhVzRpT2xzaWFuTndjbVZoWkhOb1pXVjBMbU52YlNJc0ltTnZaR1Z6WVc1a1ltOTRMbWx2SWl3aWFuTm9aV3hzTG01bGRDSXNJbU56WWk1aGNIQWlMQ0ozWldJaUxDSnNiMk5oYkdodmMzUWlYU3dpY0d4aGJpSTZJak0wSWl3aWMyTnZjR1VpT2xzaWRqY2lMQ0oyT0NJc0luWTVJaXdpZGpFd0lpd2lkakV4SWl3aVkyaGhjblJ6SWl3aVptOXliWE1pTENKbWIzSnRkV3hoSWl3aWNHRnljMlZ5SWl3aWNtVnVaR1Z5SWl3aVkyOXRiV1Z1ZEhNaUxDSnBiWEJ2Y25SbGNpSXNJbUpoY2lJc0luWmhiR2xrWVhScGIyNXpJaXdpYzJWaGNtTm9JaXdpY0hKcGJuUWlMQ0p6YUdWbGRITWlMQ0pqYkdsbGJuUWlMQ0p6WlhKMlpYSWlMQ0p6YUdGd1pYTWlYU3dpWkdWdGJ5STZkSEoxWlgwPQ==';
export default {
components: {
Spreadsheet,
Worksheet,
},
methods: {
toggle() {
if (this.$refs.spreadsheet.el.classList.contains('jss_modern')) {
this.$refs.spreadsheet.el.classList.remove('jss_modern');
} else {
this.$refs.spreadsheet.el.classList.add('jss_modern');
}
}
},
data() {
return {
license,
};
}
}
</script>
import { Component, ViewChild, ElementRef } from "@angular/core";
import jspreadsheet from "jspreadsheet";
import "jspreadsheet/dist/jspreadsheet.css"
import "jsuites/dist/jsuites.css"
// Set your JSS license key (The following key only works for one day)
jspreadsheet.setLicense('YWJkMTkzNmMwNzhhM2E0MTVkY2I1M2Y2ZGZiMWE5YmYyMDIxNTc3MDdjYjMyZTdmM2MyMzA1Y2QzYmZkNTA1YzhlMDgzYmViZmJmNTExNjU3MjJjMTNiOTIxNDAxMjc4YjA4ZmJlYWQzZmU2Y2JlNDU2YzI4MzU4NmJjMzg2NGUsZXlKamJHbGxiblJKWkNJNklpSXNJbTVoYldVaU9pSktjM0J5WldGa2MyaGxaWFFpTENKa1lYUmxJam94TnpNeU1qWTJPRE14TENKa2IyMWhhVzRpT2xzaWFuTndjbVZoWkhOb1pXVjBMbU52YlNJc0ltTnZaR1Z6WVc1a1ltOTRMbWx2SWl3aWFuTm9aV3hzTG01bGRDSXNJbU56WWk1aGNIQWlMQ0ozWldJaUxDSnNiMk5oYkdodmMzUWlYU3dpY0d4aGJpSTZJak0wSWl3aWMyTnZjR1VpT2xzaWRqY2lMQ0oyT0NJc0luWTVJaXdpZGpFd0lpd2lkakV4SWl3aVkyaGhjblJ6SWl3aVptOXliWE1pTENKbWIzSnRkV3hoSWl3aWNHRnljMlZ5SWl3aWNtVnVaR1Z5SWl3aVkyOXRiV1Z1ZEhNaUxDSnBiWEJ2Y25SbGNpSXNJbUpoY2lJc0luWmhiR2xrWVhScGIyNXpJaXdpYzJWaGNtTm9JaXdpY0hKcGJuUWlMQ0p6YUdWbGRITWlMQ0pqYkdsbGJuUWlMQ0p6WlhKMlpYSWlMQ0p6YUdGd1pYTWlYU3dpWkdWdGJ5STZkSEoxWlgwPQ==');
// Create component
@Component({
standalone: true,
selector: "app-root",
template: `<div #spreadsheet></div>
<button type="button" (click)="toggle()">Toggle</button>`,
})
export class AppComponent {
@ViewChild("spreadsheet") spreadsheet: ElementRef;
// Worksheets
worksheets: jspreadsheet.worksheetInstance[];
// Create a new data grid
ngAfterViewInit() {
// Create spreadsheet
this.worksheets = jspreadsheet(this.spreadsheet.nativeElement, {
worksheets: [{ minDimensions: [10,10] }],
});
}
toggle() {
if (this.spreadsheet.nativeElement.classList.contains('jss_modern')) {
this.spreadsheet.nativeElement.classList.remove('jss_modern');
} else {
this.spreadsheet.nativeElement.classList.add('jss_modern');
}
}
}