HCell SDK Usage Guide
This guide covers how to use the HCell SDK.
JavaScript Integration
Place the SpreadsheetSDK.js and SpreadsheetSDK.d.ts files in your desired location, then use them with the import statement.
// Check SpreadsheetSDK.js file location
import SpreadsheetSDK from "./SpreadsheetSDK";
const sdk = await SpreadsheetSDK.Instantiate({ Locale: "ko-KR" });
sdk.Initialize();
const sdkInstance = sdk.GetInstance();
const application = sdkInstance.Application;
console.log(application.ActiveWorkbook.Name);
HTML Integration
Place the SpreadsheetSDK.js file in your desired location, then use it by specifying it as the value of the src attribute of the script tag.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>HCell SDK</title>
</head>
<!-- Check SpreadsheetSDK.js file location -->
<script src="SpreadsheetSDK.js"></script>
<script>
var sdk = null;
function load() {
SpreadsheetSDK.Instantiate({ Locale: "ko-KR" }).then(instance => {
instance.Initialize();
sdk = instance;
});
}
</script>
<body onload="load()">
<script>
function loadFile() {
let input = document.createElement("input");
input.type = "file";
input.multiple = true;
input.onchange = _this => {
Array.from(_this.target.files).forEach(fileName => {
const reader = new FileReader();
reader.onload = _ => {
sdk.WriteFile("/hnc/File/" + fileName.name,
new Uint8Array(reader.result));
};
reader.readAsArrayBuffer(fileName);
});
};
input.click();
}
</script>
<div>
<button onclick="loadFile()">Load</button>
</div>
</body>
</html>