This commit is contained in:
SheetJS 2022-08-23 20:51:18 -04:00
parent 5499547bf9
commit 60dd5da9f6
10 changed files with 67 additions and 33 deletions

@ -25,6 +25,8 @@ DIF
Dialogsheet
Dialogsheets
ECMA-376
FM3
FMT
FODS
FoxPro
IEEE754
@ -49,20 +51,25 @@ SYLK
SpreadsheetML
TSV
TXT
UOS
UOS1
UOS2
Unhide
VBA
VFP
Visicalc
WB
WB1
WB2
WB3
WK
WK1
WK2
WK3
WK4
WKS
WK_
WQ
WQ1
WQ2
WQ3
@ -101,11 +108,13 @@ Base64
Booleans
Browserify
Bundlers
CLI
CMS
CS6
CapacitorJS
CommonJS
Cordova
DOM
Deno
Drash
Ethercalc
@ -115,6 +124,7 @@ GatsbyJS
HTML
HTML5
IE
IE8
IE10
IE11
IE6
@ -147,6 +157,8 @@ RequireJS
Rollup
SQLite
SWC
SWF
Serverless
SessionStorage
Snowpack
SuiteScript
@ -169,6 +181,7 @@ WebSQL
Webpack
XHR
XMLHttpRequest
XP
async
axios
bundler
@ -192,6 +205,7 @@ iWork
javascript
lifecycle
metadata
middleware
natively
node.js
nodejs

@ -53,7 +53,7 @@ sap.ui.define([
:::warning
The [SAP Website has a note about including third-party JS libraries.](https://blogs.sap.com/2017/04/30/how-to-include-third-party-libraries-modules-in-sapui5/SAPUI5)
The [SAP Website has a note about including third-party JS libraries.](https://blogs.sap.com/2017/04/30/how-to-include-third-party-libraries-modules-in-sapui5/)
It recommends copying and pasting JavaScript code.
**Copy and pasting code does not work** for SheetJS scripts as they contain

@ -1,9 +1,8 @@
---
sidebar_position: 1
title: Salesforce LWC
---
# Salesforce LWC
Salesforce apps can use third-party libraries in "Lightning Web Components".
This demo assumes familiarity with Lightning Web Components. Salesforce has a

@ -30,7 +30,7 @@ issues should be directed to the Angular project.
## Installation
[The "Frameworks" section](../getting-started/installation/frameworks) covers
installation with pnpm and other package managers.
installation with `pnpm` and other package managers.
The library can be imported directly from JS or TS code with:

@ -370,7 +370,7 @@ npx @nestjs/cli generate module sheetjs
npx @nestjs/cli generate controller sheetjs
```
3) Add Multer to the new module by editing `src/sheetjs/sheetjs.module.ts`.
3) Add `multer` to the new module by editing `src/sheetjs/sheetjs.module.ts`.
Changes are highlighted below:
```ts title="src/sheetjs/sheetjs.module.ts"

@ -210,7 +210,7 @@ the generated file. Confirm it is a valid file.
func azure functionapp publish NAME_OF_FUNCTION_APP
```
Get the function url and test using the same sequence as in step 5.
Get the function URL and test using the same sequence as in step 5.
</details>

@ -84,8 +84,8 @@ In addition to the aforementioned sheet keys, worksheets also add:
| key | Excel feature | default |
|:----------|:----------------------------------------------|:--------|
| `above` | Uncheck "Summary rows below detail" | `false` |
| `left` | Uncheck "Summary rows to the right of detail" | `false` |
| `above` | Disable "Summary rows below detail" | `false` |
| `left` | Disable "Summary rows to the right of detail" | `false` |
- `ws['!protect']`: object of write sheet protection properties. The `password`
key specifies the password for formats that support password-protected sheets

@ -533,7 +533,7 @@ takes an options argument:
| Option Name | Default | Description |
| :---------- | :------: | :-------------------------------------------------- |
|`raw` | `true` | Use raw values (true) or formatted strings (false) |
|`range` | from WS | Override Range (see table below) |
|`range` | ** | Override Range (see table below) |
|`header` | | Control output format (see table below) |
|`dateNF` | FMT 14 | Use specified date format in string output |
|`defval` | | Use specified value in place of null or undefined |

@ -147,8 +147,8 @@ curl https://bun.sh/install | bash
## Development
The `xlsx.js` and `xlsx.mjs` files are constructed from the files in the `bits`
subdirectory. The build script (run `make`) will concatenate the individual
bits to produce the scripts.
subfolder. The build script (run `make`) will concatenate the individual bits
to produce the scripts.
To produce the dist files, run `make dist`. The dist files are updated in each
version release and *should not be committed between versions*.

@ -23,9 +23,8 @@ port calculations to web apps; automate common spreadsheet tasks, and much more!
## Simple Examples
The code editors are live -- feel free to edit! Due to technical limitations,
they showcase ReactJS patterns. Other parts of the documentation will cover
more common use cases including plain JavaScript.
The code editors are live -- feel free to edit! They use ReactJS components and
run entirely in the web browser.
### Export an HTML Table to Excel XLSX
@ -51,17 +50,26 @@ more common use cases including plain JavaScript.
4) Add an event handler for the `click` event to create a workbook and download:
```js
```html
<script>
document.getElementById("sheetjsexport").addEventListener('click', function() {
/* Create worksheet from HTML DOM TABLE */
var wb = XLSX.utils.table_to_book(document.getElementById("TableToExport"));
/* Export to file (start a download) */
XLSX.writeFile(wb, "SheetJSTable.xlsx");
});
</script>
```
</details>
<details><summary><b>How to automate with NodeJS</b> (click to show)</summary>
[The "Headless Automation" demo](http://localhost:3000/docs/demos/headless)
includes complete examples using the `puppeteer` and `playwright` libraries.
</details>
<details open><summary><b>Live Example</b> (click to hide)</summary>
```jsx live
@ -164,50 +172,63 @@ support for CSS styling and rich text.
</details>
### Convert a CSV file to HTML Table and Excel XLSX
### Preview a workbook on your device
<details><summary><b>Live Example</b> (click to show)</summary>
<details open><summary><b>Live Example</b> (click to hide)</summary>
This example starts from a CSV string. Use the File Input element to select
a workbook to load. Use the "Export XLSX" button to write the table to XLSX.
```jsx live
/* The live editor requires this function wrapper */
function Tabeller(props) {
const [__html, setHTML] = React.useState("");
/* Starting CSV data -- change data here */
const csv = `\
/* Load sample data once */
React.useEffect(() => {
/* Starting CSV data -- change data here */
const csv = `\
This,is,a,Test
வணக்கம்,สวัสดี,你好,가지마
1,2,3,4`;
/* Parse CSV into a workbook object */
const wb = XLSX.read(csv, {type: "string"});
/* Parse CSV into a workbook object */
const wb = XLSX.read(csv, {type: "string"});
/* Get the worksheet (default name "Sheet1") */
const ws = wb.Sheets.Sheet1;
/* Get the worksheet (default name "Sheet1") */
const ws = wb.Sheets.Sheet1;
/* Create HTML table */
const id = "tabeller"; // HTML TABLE ID
const __html = XLSX.utils.sheet_to_html(ws, { id });
/* Create HTML table */
setHTML(XLSX.utils.sheet_to_html(ws, { id: "tabeller" }));
}, []);
return (<>
{/* Import Button */}
<input type="file" onChange={async(e) => {
/* get data as an ArrayBuffer */
const file = e.target.files[0];
const data = await file.arrayBuffer();
{/* Show HTML preview */}
<div dangerouslySetInnerHTML={{__html}}/>
/* parse and load first worksheet */
const wb = XLSX.read(data);
const ws = wb.Sheets[wb.SheetNames[0]];
setHTML(XLSX.utils.sheet_to_html(ws, { id: "tabeller" }));
}}/>
{/* Export Button */}
<button onClick={() => {
/* Create worksheet from HTML DOM TABLE */
const table = document.getElementById(id);
const table = document.getElementById("tabeller");
const wb = XLSX.utils.table_to_book(table);
/* Export to file (start a download) */
XLSX.writeFile(wb, "SheetJSIntro.xlsx");
}}>
<b>Export XLSX!</b>
</button>
}}><b>Export XLSX!</b></button>
{/* Show HTML preview */}
<div dangerouslySetInnerHTML={{__html}}/>
</>);
}
```