This commit is contained in:
SheetJS 2023-09-19 15:08:29 -04:00
parent 8914e8f714
commit 7a1b75d50b
26 changed files with 177 additions and 55 deletions

View File

@ -57,7 +57,9 @@ new versions are released!
:::
:::warning
### Legacy Endpoints
:::warning pass
Older releases are technically available on the public npm registry as `xlsx`,
but the registry is out of date. The latest version on that registry is 0.18.5
@ -130,7 +132,7 @@ pnpm install file:vendor/xlsx-${current}.tgz`}
</TabItem>
<TabItem value="yarn" label="Yarn" default>
<CodeBlock language="bash">{`\
yarn add file:vendor/xlsx-${current}.tgz`}
yarn add file:vendor/xlsx-${current}.tgz`}
</CodeBlock>
</TabItem>
</Tabs>

View File

@ -13,7 +13,7 @@ import CodeBlock from '@theme/CodeBlock';
# NodeJS
Tarballs are available on <https://cdn.sheetjs.com>.
Package tarballs are available on <https://cdn.sheetjs.com>.
<p><a href={`https://cdn.sheetjs.com/xlsx-${current}/xlsx-${current}.tgz`}>https://cdn.sheetjs.com/xlsx-{current}/xlsx-{current}.tgz</a> is the URL for version {current}</p>
@ -49,7 +49,7 @@ new versions are released!
### Legacy Endpoints
:::warning
:::warning pass
Older releases are technically available on the public npm registry as `xlsx`,
but the registry is out of date. The latest version on that registry is 0.18.5
@ -122,7 +122,7 @@ pnpm install file:vendor/xlsx-${current}.tgz`}
</TabItem>
<TabItem value="yarn" label="Yarn" default>
<CodeBlock language="bash">{`\
yarn add file:vendor/xlsx-${current}.tgz`}
yarn add file:vendor/xlsx-${current}.tgz`}
</CodeBlock>
</TabItem>
</Tabs>
@ -131,6 +131,14 @@ The package will be installed and accessible as `xlsx`.
## Usage
The package supports CommonJS `require` and ESM `import` module systems.
:::info pass
**It is strongly recommended to use CommonJS in NodeJS.**
:::
#### CommonJS `require`
By default, the module supports `require` and it will automatically add support
@ -163,7 +171,7 @@ XLSX.set_cptable(cpexcel);
#### NextJS
:::warning
:::warning pass
`fs` cannot be imported from the top level in NextJS pages. This will not work:

View File

@ -699,7 +699,7 @@ node SheetJSNodeJS.js
This script will write a new file `Presidents.xlsx` in the same folder.
:::caution
:::caution pass
Native `fetch` support was added in NodeJS 18. For older versions of NodeJS,
the script will throw an error `fetch is not defined`. A third-party library
@ -1102,7 +1102,7 @@ in the Files app and can be opened with the Google Sheets app.
</TabItem>
<TabItem value="ios" label="iOS">
:::caution
:::caution pass
This demo runs in iOS and requires a Macintosh computer with Xcode installed.

View File

@ -1018,7 +1018,7 @@ the Android device can be connected to the computer with a USB cable.
</TabItem>
<TabItem value="ios" label="iOS">
:::caution
:::caution pass
This demo runs in iOS and requires a Macintosh computer with Xcode installed.

View File

@ -22,7 +22,7 @@ Other demos cover general Angular deployments, including:
- [iOS and Android applications powered by NativeScript](/docs/demos/mobile/nativescript)
- [iOS and Android applications powered by Ionic](/docs/demos/mobile/ionic)
:::warning
:::caution pass
Angular tooling uses native NodeJS modules. There are a number of issues when
trying to run Angular projects with different NodeJS versions. These issues
@ -30,7 +30,7 @@ should be directed to the Angular project.
:::
:::caution
:::warning Telemetry
Angular CLI enables telemetry by default. When using a recent version, disable
analytics globally through the CLI tool before creating a new project:
@ -340,7 +340,7 @@ this.columns = Array.from({ length: range.e.c + 1 }, (_, i) => ({
## Older Versions
:::warning
:::warning pass
This demo is included for legacy deployments. There are incompatibilities with
different NodeJS and other ecosystem versions. Issues should be raised with

View File

@ -850,7 +850,7 @@ Click on "Click here to export" to generate a file.
SWC provides `spack` for bundling scripts.
:::warning
:::warning pass
When this demo was last tested, there was a bug affecting 1.2.247 and 1.3 . It
is strongly recommended to use `@swc/core@1.2.245` until the bug is fixed.

View File

@ -56,7 +56,7 @@ through a special Export button. It handles the SheetJS operations internally.
### Angular UI Grid
:::warning
:::warning pass
This UI Grid is for AngularJS, not the modern Angular. New projects should not
use AngularJS. This demo is included for legacy applications.
@ -124,7 +124,7 @@ function export_html_table(table) {
} // yes, it's that easy!
```
:::info
:::info pass
SheetJS CE is focused on data preservation and will extract values from tables.

View File

@ -665,7 +665,7 @@ was added to the platform, third party modules wrapped the native APIs.
#### request
:::warning
:::warning pass
`request` has been deprecated and should only be used in legacy deployments.

View File

@ -22,7 +22,7 @@ This demo covers three workflows:
- [Reading mail](#reading-mail) covers libraries for reading messages
- [Data files](#data-files) covers mailbox file formats
:::warning
:::warning pass
There are a number of caveats when dealing with live mail servers. It is advised
to follow connector module documentation carefully and test with new accounts
@ -32,7 +32,7 @@ before integrating with important inboxes or accounts.
## Live Servers
:::warning
:::warning pass
It is strongly advised to use a test email address before using an important
address. One small mistake could erase decades of messages or result in a block

View File

@ -1,5 +1,5 @@
---
title: React Native
title: Sheets on the Desktop with React Native
sidebar_label: React Native
description: Build data-intensive desktop apps with React Native. Seamlessly integrate spreadsheets into your app using SheetJS. Securely process and generate Excel files at the desk.
pagination_prev: demos/mobile/index
@ -9,8 +9,6 @@ sidebar_custom_props:
summary: Native Components with React
---
# Sheets on the Desktop with React Native
import current from '/version.js';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
@ -50,8 +48,9 @@ This demo was tested in the following environments:
|:---------------|:-----|:------------|:-----------|
| Windows 10 | x64 | `v0.71.25` | 2023-07-24 |
| Windows 11 | x64 | `v0.71.11` | 2023-05-11 |
| Windows 11 | ARM | `v0.72.9` | 2023-09-18 |
| MacOS 12.6 | x64 | `v0.71.26` | 2023-07-23 |
| MacOS 13.4 | ARM | `v0.71.18` | 2023-07-06 |
| MacOS 13.5.2 | ARM | `v0.72.4` | 2023-09-18 |
:::
@ -62,6 +61,20 @@ applications, [check the mobile demo](/docs/demos/mobile/reactnative)
:::
:::warning Telemetry
**React Native for Windows + macOS commands include telemetry without proper**
**disclaimer or global opt-out.**
The recommended approach for suppressing telemetry is explicitly passing the
`--no-telemetry` flag. The following commands are known to support the flag:
- Initializing a macOS project with `react-native-macos-init`
- Initializing a Windows project with `react-native-windows-init`
- Running Windows apps with `react-native run-windows`
:::
## Integration Details
The [SheetJS NodeJS Module](/docs/getting-started/installation/nodejs) can be
@ -366,7 +379,7 @@ RCT_EXPORT_METHOD(PickAndRead:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromi
## Windows Demo
:::warning
:::warning pass
There is no simple standalone executable file at the end of the process.
@ -393,10 +406,10 @@ used to switch the NodeJS version.
### Project Setup
1) Create a new project using React Native `0.71`:
1) Create a new project using React Native `0.72`:
```bash
npx react-native init SheetJSWin --template react-native@^0.71.0
npx react-native init SheetJSWin --template react-native@^0.72.0
cd SheetJSWin
```
@ -427,6 +440,9 @@ npm i --save https://cdn.sheetjs.com/xlsx-${current}/xlsx-${current}.tgz`}
4) To ensure that the app works, launch the app:
<Tabs groupId="arch">
<TabItem value="x64" label="x64 (64-bit Windows)">
```bash
npx react-native run-windows --no-telemetry
```
@ -441,6 +457,30 @@ Specific Windows SDK versions can be installed through Visual Studio Installer.
:::
</TabItem>
<TabItem value="arm" label="ARM64">
```bash
npx react-native run-windows --no-telemetry --arch=X86
```
:::warning pass
The ARM64 binary is normally built with
```bash
npx react-native run-windows --no-telemetry --arch=ARM64
```
When this demo was last tested on Windows 11 ARM, the build failed.
**As it affects the starter project, it is a bug in ARM64 React Native Windows**
:::
</TabItem>
</Tabs>
### Native Module
<Tabs groupId="rnwlang">
@ -540,10 +580,37 @@ curl -LO https://docs.sheetjs.com/reactnative/rnw/App.tsx
8) Test the app again:
<Tabs groupId="arch">
<TabItem value="x64" label="x64 (64-bit Windows)">
```bash
npx react-native run-windows --no-telemetry
```
</TabItem>
<TabItem value="arm" label="ARM64">
```bash
npx react-native run-windows --no-telemetry --arch=X86
```
:::warning pass
The ARM64 binary is normally built with
```bash
npx react-native run-windows --no-telemetry --arch=ARM64
```
When this demo was last tested on Windows 11 ARM, the build failed.
**As it affects the starter project, it is a bug in ARM64 React Native Windows**
:::
</TabItem>
</Tabs>
Download <https://sheetjs.com/pres.xlsx>.
Click "Click here to Open File!" and use the file picker to select `pres.xlsx` .
@ -556,10 +623,10 @@ The app will refresh and display the data from the file.
### Project Setup
1) Create a new React Native project using React Native `0.71`:
1) Create a new React Native project using React Native `0.72`:
```bash
npx -y react-native init SheetJSmacOS --template react-native@^0.71.0
npx -y react-native init SheetJSmacOS --template react-native@^0.72.0
cd SheetJSmacOS
```

View File

@ -215,7 +215,7 @@ module 4.6.7 and NodeJS 20.5.1.
:::
:::warning
:::warning pass
The most recent version of the `redis` node module does not work with most
versions of NodeJS. It is "ESM-only", requiring NodeJS 18 or later. As a result,

View File

@ -11,7 +11,7 @@ sidebar_custom_props:
<script type="text/javascript" src="https://unpkg.com/dexie@3.2.4/dist/dexie.js"></script>
</head>
:::warning
:::warning pass
IndexedDB is a very low-level API.

View File

@ -123,7 +123,7 @@ to be renamed to `sheetjs.js` when adding the static resource.
<p>1) Download <a href={`https://cdn.sheetjs.com/xlsx-${current}/package/dist/xlsx.full.min.js`}>https://cdn.sheetjs.com/xlsx-{current}/package/dist/xlsx.full.min.js</a></p>
:::warning
:::warning pass
**DO NOT "COPY AND PASTE"!** The file should be explicitly downloaded. Copying
and pasting corrupts the source code and the component will fail in subtle ways.

View File

@ -30,7 +30,7 @@ This was tested on 2023 April 29.
This discussion focuses on the "HTTP Trigger" function type.
:::info
:::info pass
To enable binary data processing, a setting must be changed in `function.json`:

View File

@ -104,7 +104,7 @@ the source data or artifacts from the `postprocess` script changed.
### Post-Processing Data
:::warning
:::warning pass
The `flat-postprocessing` library includes a number of utilities for different
data formats. The `readXLSX` helper uses SheetJS under the hood.

View File

@ -12,7 +12,7 @@ Deno Deploy offers "Serverless Functions" powered by Deno.
The [Deno installation](/docs/getting-started/installation/deno) instructions
apply to Deno Deploy scripts.
:::warning
:::warning pass
Deno Deploy does not offer any sort of temporary file access in functions.

View File

@ -692,7 +692,7 @@ JSON file in step 27. The `./` prefix is required!
39) Run the script:
```bash
node load.mjs
node dump.mjs
```
The script should create a file `SheetJS.xlsb` in the project folder. This file

View File

@ -204,7 +204,7 @@ var button = Dropbox.createSaveButton( url, "SheetJSDropbox.xls", {
document.appendChild(button);
```
:::info
:::info pass
The file must be written before the Save button is created.

View File

@ -25,6 +25,17 @@ The ["Integration Example"](#integration-example) section includes a complete
command-line tool for reading arbitrary workbooks and writing data to XLSB
(Excel 2007+ Binary Format) workbooks.
:::warning Telemetry
**The `dotnet` command embeds telemetry.**
The `DOTNET_CLI_TELEMETRY_OPTOUT` environment variable should be set to `1`.
["Platform Configuration"](#platform-configuration) includes instructions for
setting the environment variable on supported platforms.
:::
## Integration Details
:::note pass

View File

@ -203,7 +203,7 @@ cd ..
</TabItem>
<TabItem value="darwin-arm" label="Apple Silicon">
:::info
:::info pass
When the demo was last tested, ChakraCore JIT was not supported.

View File

@ -7,7 +7,7 @@ pagination_next: solutions/input
import current from '/version.js';
import CodeBlock from '@theme/CodeBlock';
:::warning
:::warning pass
In a production application, it is strongly recommended to use a binding for a
C engine like [`JavaScript::Duktape`](/docs/demos/engines/duktape#perl)

View File

@ -42,7 +42,7 @@ The `readFile` method attempts to read a spreadsheet file at the supplied path.
The second `opts` argument is optional. ["Parsing Options"](/docs/api/parse-options)
covers the supported properties and behaviors.
:::warning
:::warning pass
Browsers generally do not allow reading files by specifying filename (it is a
security risk), and running `XLSX.readFile` in the browser will throw an error.

View File

@ -136,7 +136,7 @@ worker.addEventListener('message', function(e) {
<details>
<summary><b>SWF workaround for Windows 95+</b> (click to show)</summary>
:::warning
:::warning pass
Each moving part in this solution has been deprecated years ago:

View File

@ -338,7 +338,7 @@ function SheetJSExportAOO() {
```
:::info
:::info pass
The [example sheet](#example-sheet) cannot be reproduced using plain objects
since JS object keys must be unique.

View File

@ -45,6 +45,7 @@ These instructions were tested on the following platforms:
| MacOS 13.0 (ARM64) | 2023-04-13 |
| Windows 10 (x64) + WSL Ubuntu | 2023-07-23 |
| Windows 11 (x64) + WSL Ubuntu | 2023-08-31 |
| Windows 11 (ARM) + WSL Ubuntu | 2023-09-18 |
With some additional dependencies, the unminified scripts are reproducible and
tests will pass in Windows XP with NodeJS 5.10.0.
@ -63,7 +64,17 @@ import TabItem from '@theme/TabItem';
A) Ensure WSL ("WSL 2" in Windows 10) and the Ubuntu distribution are installed.
B) Install mercurial and subversion.
B) Install mercurial and subversion:
```bash
sudo apt-get update
sudo apt-get install mercurial subversion
```
:::note pass
In some Windows 10 runs, `mercurial` and `subversion` were not available in the
default Ubuntu distro. A separate repository is available:
```bash
# Install support programs for the build and test commands
@ -73,6 +84,15 @@ sudo apt-get install mercurial subversion
sudo add-apt-repository --remove ppa:mercurial-ppa/releases
```
If the first command displays an error involving a missing release file, remove
the repo before proceeding:
```bash
sudo add-apt-repository --remove ppa:mercurial-ppa/releases
```
:::
C) Install NodeJS
:::info pass
@ -110,17 +130,25 @@ sudo apt-get install -y npm
:::
D) Build and install a version of Git with proper SSL support:
D) Test clone the [`js-crc32` repo](https://git.sheetjs.com/sheetjs/js-crc32)
```bash
git clone https://git.sheetjs.com/sheetjs/js-crc32
```
If this clone fails with an error message that mentions SSL or secure connection
or certificates, build and install a version of Git with proper SSL support:
```bash
# Git does not support OpenSSL out of the box, must do this
curl -LO https://github.com/paul-nelson-baker/git-openssl-shellscript/raw/main/compile-git-with-openssl.sh
curl -LO https://github.com/niko-dunixi/git-openssl-shellscript/raw/main/compile-git-with-openssl.sh
chmod +x compile-git-with-openssl.sh
./compile-git-with-openssl.sh
```
E) Set `git` config `core.autocrlf` setting to `false`. The following commands
should be run twice, once within PowerShell and once within WSL bash:
should be run twice, once within PowerShell (if Git for Windows is installed)
and once within WSL bash:
```bash
git config --global --add core.autocrlf false
@ -167,7 +195,7 @@ brew install mercurial subversion
E) Install NodeJS
:::note
:::note pass
[The official NodeJS site](https://nodejs.org/en/download/) provides installers
for "LTS" and "Current" releases. The "LTS" version should be installed.
@ -221,7 +249,7 @@ sudo pacman-key --refresh-keys
sudo pacman -S base-devel mercurial subversion
```
:::note
:::note pass
In local testing on the Steam Deck, some of the C / C++ demos failed to build.
This issue was resolved by manually installing `glibc` and `linux-api-headers`:
@ -238,7 +266,7 @@ This is *not required* for building or testing the library.
After installing mercurial and subversion, install NodeJS.
:::note
:::note pass
[The official NodeJS site](https://nodejs.org/en/download/) provides installers
for "LTS" and "Current" releases. The "LTS" version should be installed.
@ -285,7 +313,13 @@ make init
This step may take a while as it will be downloading a number of test files.
3) Run a build and verify with a short test:
3) Run the `esbuild` tool once:
```bash
npx -y esbuild@0.14.14
```
4) Run a build and verify with a short test:
```bash
# Full Build
@ -302,7 +336,7 @@ git checkout -- .
### Reproduce official builds
4) Run `git log` and search for the commit that matches a particular release
5) Run `git log` and search for the commit that matches a particular release
version. For example, version `0.20.0` can be found with:
```bash
@ -321,13 +355,13 @@ Date: Fri Jun 23 05:48:47 2023 -0400
version bump 0.20.0
```
5) Switch to that commit:
6) Switch to that commit:
```bash
git checkout 955543147dac0274d20307057c5a9f3e3e5d5307
```
6) Run the full build sequence
7) Run the full build sequence
```bash
make clean; make
@ -336,7 +370,7 @@ make
make dist
```
7) To verify that the files are intact, use `md5sum` (`md5` on MacOS).
8) To verify that the files are intact, use `md5sum` (`md5` on MacOS).
The local checksum for the browser script can be computed with:
@ -354,7 +388,7 @@ $ curl -L https://cdn.sheetjs.com/xlsx-0.20.0/package/dist/xlsx.full.min.js | md
The two hashes should match.
8) To return to the HEAD commit, run
9) To return to the HEAD commit, run
```bash
git checkout master
@ -362,7 +396,7 @@ git checkout master
### Test in web browsers
9) Start local server:
10) Start local server:
```bash
make ctestserv
@ -374,7 +408,7 @@ The terminal will display a port number. For example:
Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/)
```
10) Open a browser window and access `http://localhost:8000`, replacing `8000`
11) Open a browser window and access `http://localhost:8000`, replacing `8000`
with the port number from the terminal window.
## Development