Handsontable example
HTML
<script src="https://unpkg.com/hyperformula@2.6.2/dist/hyperformula.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/handsontable@14.2/dist/handsontable.full.min.js"></script>
<link type="text/css" rel="stylesheet" href="https://cdn.jsdelivr.net/npm/handsontable@14.2/dist/handsontable.full.min.css" />
<script src="https://cdn.jsdelivr.net/npm/react@17/umd/react.production.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/react-dom@17/umd/react-dom.production.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@handsontable/react@14.2/dist/react-handsontable.min.js"></script>
<script src="https://handsontable.com/docs/scripts/fixer.js"></script>
<div id="example" class="hot "></div>
Babel + JSX
import { HotTable } from '@handsontable/react';
import { registerAllModules } from 'handsontable/registry';
import HyperFormula from "hyperformula";
import 'handsontable/dist/handsontable.full.min.css';
import {useRef, useEffect} from 'react'
// register Handsontable's modules
registerAllModules();
const hyperformulaInstance = HyperFormula.buildEmpty({
precisionRounding: 10,
licenseKey: "gpl-v3"
});
export const ExampleComponent = () => {
console.log(`%c Using HyperFormula ${HyperFormula.version}`, 'color: blue; font-weight: bold');
const table1 = useRef(null)
const table3 = useRef(null)
/* useEffect(()=> {
if (table3.current.hotInstance){
table1.current.hotInstance.loadData([[`=INDEX(Sheet1!B:Sheet1!B,MATCH("Agriculture",Sheet1!A:Sheet1!A,0))`]])
}
}, [table3.current]) */
return (<div>
<HotTable
ref={table1}
data={[[`=INDEX(Sheet1!B:Sheet1!B,MATCH("Agriculture",Sheet1!A:Sheet1!A,0))`]]}
licenseKey="non-commercial-and-evaluation"
formulas={{
engine: hyperformulaInstance,
sheetName: "Sheet2"
}}
/>
<HotTable
data={
[
["Agriculture", "37.23%"],
[
"Crop and animal production, hunting and related service activities",
"30.24%"
],
["Forestry and logging", "35.97%"],
["Fishing and aquaculture", "37.42%"],
["Architects", "53.31%"],
[
"Architectural and engineering activities; technical testing and analysis",
"47.80%"
],
["Care Homes and Nurseries", "44.70%"],
["Human health activities", "53.46%"],
["Residential care activities", "49.04%"],
["Social work activities without accommodation", "48.74%"],
["Construction", "26.65%"],
["Construction of buildings", "35.55%"],
["Civil engineering",...