Exit 01 · Your product
Copy the code for this
What this playground does, for the Sheet kit and household-budget.xlsx: the editor in your page, or the same engine in a script.
import { KitionEmbed } from '@kition/sdk/embed'
// The same editor as the playground's, in your page.
const editor = await KitionEmbed.mount(element, {
kit: {
id: 'kit.sheet',
// static files on your CDN: the editor and its WebAssembly engine
url: 'https://cdn.example.com/kition/sheet-ui/',
},
file: { id: file.id, name: "household-budget.xlsx" },
// your StorageProvider:
// read, stamp, write (versioned), create
storage,
locale: 'en-US',
theme: { colorScheme: 'dark' },
})
await editor.ready()
// "Download" here: save through your storage,
// then read the bytes it wrote.
await editor.save()// In the folder containing your document, run: npm install @kition/sdk @kition/sheet
import { readFileSync, writeFileSync } from 'node:fs'
import { openKitPackage } from '@kition/sdk/script/node'
import '@kition/sdk/script/kits/sheet'
// The same Sheet engine as the editor, in Node, with no page.
const kit = await openKitPackage('./node_modules/@kition/sheet/sheet-ui')
const file = kit.open("household-budget.xlsx", readFileSync("household-budget.xlsx"))
const doc = await file.model()
// the object model and every command
const described = await doc.describe()
// ... edit through typed proxies (doc.run), then:
writeFileSync("household-budget.xlsx", file.save())Only previewing files? Kition Viewer opens them read-only, with no toolbar.