forked from sheetjs/docs.sheetjs.com
		
	v8-windows
This commit is contained in:
		
							parent
							
								
									584af134db
								
							
						
					
					
						commit
						a6aba251e5
					
				@ -30,7 +30,7 @@ sequenceDiagram
 | 
			
		||||
  actor U as User
 | 
			
		||||
  participant P as Page
 | 
			
		||||
  participant A as Site
 | 
			
		||||
  U->>P: click button
 | 
			
		||||
  U->>P: load site
 | 
			
		||||
  P->>A: fetch file
 | 
			
		||||
  A->>P: raw file
 | 
			
		||||
  Note over P: parse file
 | 
			
		||||
 | 
			
		||||
@ -1,5 +1,5 @@
 | 
			
		||||
---
 | 
			
		||||
title: Wails
 | 
			
		||||
title: Spreadsheet-Powered Wails Apps
 | 
			
		||||
sidebar_label: Wails
 | 
			
		||||
description: Build data-intensive desktop apps using Wails. Seamlessly integrate spreadsheets into your app using SheetJS. Modernize Excel-powered business processes with confidence.
 | 
			
		||||
pagination_prev: demos/mobile/index
 | 
			
		||||
@ -9,8 +9,6 @@ sidebar_custom_props:
 | 
			
		||||
  summary: Webview + Go Backend
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
# Spreadsheet-Powered Wails Apps
 | 
			
		||||
 | 
			
		||||
import current from '/version.js';
 | 
			
		||||
import Tabs from '@theme/Tabs';
 | 
			
		||||
import TabItem from '@theme/TabItem';
 | 
			
		||||
@ -47,10 +45,11 @@ app to read and write workbooks. The app will look like the screenshots below:
 | 
			
		||||
 | 
			
		||||
</td></tr></tbody></table>
 | 
			
		||||
 | 
			
		||||
:::info
 | 
			
		||||
:::tip pass
 | 
			
		||||
 | 
			
		||||
This demo assumes some familiarity with JavaScript and with Go. If you would
 | 
			
		||||
prefer a pure JavaScript solution, the [Electron](/docs/demos/desktop/electron)
 | 
			
		||||
This demo assumes familiarity with the Go programming language.
 | 
			
		||||
 | 
			
		||||
For a pure JavaScript solution, the [Electron](/docs/demos/desktop/electron)
 | 
			
		||||
platform provides many native features out of the box.
 | 
			
		||||
 | 
			
		||||
:::
 | 
			
		||||
@ -60,11 +59,11 @@ platform provides many native features out of the box.
 | 
			
		||||
The [SheetJS NodeJS Module](/docs/getting-started/installation/nodejs) can be
 | 
			
		||||
installed in the `frontend` folder and imported in frontend scripts.
 | 
			
		||||
 | 
			
		||||
:::caution
 | 
			
		||||
:::caution pass
 | 
			
		||||
 | 
			
		||||
Wails currently does not provide the equivalent of NodeJS `fs` module.
 | 
			
		||||
 | 
			
		||||
Reading and writing raw file data must be implemented in native Go code.
 | 
			
		||||
**Reading and writing raw file data must be implemented in native Go code.**
 | 
			
		||||
 | 
			
		||||
:::
 | 
			
		||||
 | 
			
		||||
@ -144,6 +143,8 @@ func (a *App) ReadFile() string {
 | 
			
		||||
Wails will automatically create bindings for use in JS. The `App` binding module
 | 
			
		||||
will export the function `ReadFile`.
 | 
			
		||||
 | 
			
		||||
The following example uses the [SvelteJS](/docs/demos/frontend/svelte) framework:
 | 
			
		||||
 | 
			
		||||
```js title="frontend/src/App.svelte"
 | 
			
		||||
import { read, utils } from 'xlsx';
 | 
			
		||||
import { ReadFile } from '../wailsjs/go/main/App';
 | 
			
		||||
@ -163,7 +164,7 @@ async function importFile(evt) {
 | 
			
		||||
 | 
			
		||||
### Writing Files
 | 
			
		||||
 | 
			
		||||
:::info
 | 
			
		||||
:::info pass
 | 
			
		||||
 | 
			
		||||
The SheetJS `write` method[^7] can write spreadsheets in a number of formats[^8]
 | 
			
		||||
including XLSX, XLSB, XLS, and NUMBERS. It expects a `bookType` option. This
 | 
			
		||||
@ -262,7 +263,9 @@ func (a *App) WriteFile(b64 string, path string) {
 | 
			
		||||
#### JS
 | 
			
		||||
 | 
			
		||||
Wails will automatically create bindings for use in JS. The `App` binding module
 | 
			
		||||
will export the functions `SaveFile` and `WriteFile`:
 | 
			
		||||
will export the functions `SaveFile` and `WriteFile`.
 | 
			
		||||
 | 
			
		||||
The following example uses the [SvelteJS](/docs/demos/frontend/svelte) framework:
 | 
			
		||||
 | 
			
		||||
```js title="frontend/src/App.svelte"
 | 
			
		||||
import { utils, write } from 'xlsx';
 | 
			
		||||
@ -290,8 +293,14 @@ async function exportFile(table_element) {
 | 
			
		||||
 | 
			
		||||
:::note
 | 
			
		||||
 | 
			
		||||
This demo was tested against Wails `v2.4.1` on 2023 April 30 using
 | 
			
		||||
the Svelte TypeScript starter.
 | 
			
		||||
This demo was tested in the following environments:
 | 
			
		||||
 | 
			
		||||
| OS and Version | Arch | Wails    | Date       |
 | 
			
		||||
|:---------------|:-----|:---------|:-----------|
 | 
			
		||||
| macOS 12.6.3   | x64  | `v2.5.1` | 2023-08-24 |
 | 
			
		||||
| macOS 13.5.1   | ARM  | `v2.5.1` | 2023-08-24 |
 | 
			
		||||
| Windows 10     | x64  | `v2.5.1` | 2023-08-25 |
 | 
			
		||||
| Linux (HoloOS) | x64  | `v2.5.1` | 2023-08-25 |
 | 
			
		||||
 | 
			
		||||
:::
 | 
			
		||||
 | 
			
		||||
@ -326,12 +335,22 @@ Your system is ready for Wails development!
 | 
			
		||||
 | 
			
		||||
If a required dependency is missing, it will be displayed.
 | 
			
		||||
 | 
			
		||||
:::note
 | 
			
		||||
:::note pass
 | 
			
		||||
 | 
			
		||||
None of the optional packages are required for building and running this demo.
 | 
			
		||||
 | 
			
		||||
:::
 | 
			
		||||
 | 
			
		||||
:::info pass
 | 
			
		||||
 | 
			
		||||
On the Steam Deck (HoloOS), some dependencies must be reinstalled:
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
sudo pacman -Syu base-devel gtk glib2 pango harfbuzz cairo gdk-pixbuf2 atk libsoup
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
:::
 | 
			
		||||
 | 
			
		||||
</details>
 | 
			
		||||
 | 
			
		||||
1) Create a new Wails app:
 | 
			
		||||
@ -374,6 +393,15 @@ wails build
 | 
			
		||||
 | 
			
		||||
At the end, it will print the path to the generated program. Run the program!
 | 
			
		||||
 | 
			
		||||
**Testing**
 | 
			
		||||
 | 
			
		||||
When run, the program will download [`pres.xlsx`](https://sheetjs.com/pres.xlsx)
 | 
			
		||||
and display the contents of the first worksheet in a table.
 | 
			
		||||
 | 
			
		||||
To test export features, click "Export XLSX". The app will ask for a file name
 | 
			
		||||
and location. After clicking Save, the app will export to XLSX. This file can be
 | 
			
		||||
opened in a spreadsheet editor such as Excel.
 | 
			
		||||
 | 
			
		||||
[^1]: See ["How does it Work?"](https://wails.io/docs/howdoesitwork) in the Wails documentation.
 | 
			
		||||
[^2]: See [`read` in "Reading Files"](/docs/api/parse-options)
 | 
			
		||||
[^3]: See [`sheet_to_html` in "Utilities"](/docs/api/utilities/html#html-table-output)
 | 
			
		||||
 | 
			
		||||
@ -1,5 +1,7 @@
 | 
			
		||||
---
 | 
			
		||||
title: C++ + V8
 | 
			
		||||
title: Blazing Fast Data Processing with V8
 | 
			
		||||
sidebar_label: C++ + V8
 | 
			
		||||
description: Process structured data in C++ or Rust programs. Seamlessly integrate spreadsheets by paring V8 and SheetJS. Modernize  workflows while preserving Excel compatibility.
 | 
			
		||||
pagination_prev: demos/bigdata/index
 | 
			
		||||
pagination_next: solutions/input
 | 
			
		||||
---
 | 
			
		||||
@ -9,14 +11,25 @@ import Tabs from '@theme/Tabs';
 | 
			
		||||
import TabItem from '@theme/TabItem';
 | 
			
		||||
import CodeBlock from '@theme/CodeBlock';
 | 
			
		||||
 | 
			
		||||
V8 is an embeddable JS engine written in C++. It powers Chromium and Chrome,
 | 
			
		||||
NodeJS and Deno, Adobe UXP and other platforms.
 | 
			
		||||
[V8](https://v8.dev/) is an embeddable JavaScript engine written in C++. It
 | 
			
		||||
powers Chromium and Chrome, NodeJS and Deno, Adobe UXP and other platforms.
 | 
			
		||||
 | 
			
		||||
The [Standalone scripts](/docs/getting-started/installation/standalone) can be
 | 
			
		||||
parsed and evaluated in a V8 context.
 | 
			
		||||
[SheetJS](https://sheetjs.com) is a JavaScript library for reading and writing
 | 
			
		||||
data from spreadsheets.
 | 
			
		||||
 | 
			
		||||
This demo uses V8 and SheetJS to read and write spreadsheets. We'll explore how
 | 
			
		||||
to load SheetJS in a V8 context and process spreadsheets and structured data from
 | 
			
		||||
C++ and Rust programs.
 | 
			
		||||
 | 
			
		||||
The ["Complete Example"](#complete-example) creates a C++ command-line tool for
 | 
			
		||||
reading spreadsheet files and generating new workbooks. ["Bindings"](#bindings)
 | 
			
		||||
covers V8 engine bindings for other programming languages.
 | 
			
		||||
 | 
			
		||||
## Integration Details
 | 
			
		||||
 | 
			
		||||
The [SheetJS Standalone scripts](/docs/getting-started/installation/standalone)
 | 
			
		||||
can be parsed and evaluated in a V8 context.
 | 
			
		||||
 | 
			
		||||
_Initialize V8_
 | 
			
		||||
 | 
			
		||||
The official V8 `hello-world` example covers initialization and cleanup. For the
 | 
			
		||||
@ -30,10 +43,10 @@ v8::Local<v8::Context> context = v8::Context::New(isolate);
 | 
			
		||||
The following helper function evaluates C strings as JS code:
 | 
			
		||||
 | 
			
		||||
```cpp
 | 
			
		||||
v8::Local<v8::Value> eval_code(v8::Isolate *i, v8::Local<v8::Context> c, char* code) {
 | 
			
		||||
  v8::Local<v8::String> source = v8::String::NewFromUtf8(i, code).ToLocalChecked();
 | 
			
		||||
  v8::Local<v8::Script> script = v8::Script::Compile(i, source).ToLocalChecked();
 | 
			
		||||
  return script->Run(c).ToLocalChecked();
 | 
			
		||||
v8::Local<v8::Value> eval_code(v8::Isolate *isolate, v8::Local<v8::Context> context, char* code, size_t sz = -1) {
 | 
			
		||||
  v8::Local<v8::String> source = v8::String::NewFromUtf8(isolate, code, v8::NewStringType::kNormal, sz).ToLocalChecked();
 | 
			
		||||
  v8::Local<v8::Script> script = v8::Script::Compile(context, source).ToLocalChecked();
 | 
			
		||||
  return script->Run(context).ToLocalChecked();
 | 
			
		||||
}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
@ -56,7 +69,7 @@ static char *read_file(const char *filename, size_t *sz) {
 | 
			
		||||
 | 
			
		||||
// ...
 | 
			
		||||
  size_t sz; char *file = read_file("xlsx.full.min.js", &sz);
 | 
			
		||||
  v8::Local<v8::Value> result = eval_code(isolate, context, file);
 | 
			
		||||
  v8::Local<v8::Value> result = eval_code(isolate, context, file, sz);
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
To confirm the library is loaded, `XLSX.version` can be inspected:
 | 
			
		||||
@ -109,25 +122,26 @@ The resulting `buf` can be written to file with `fwrite`.
 | 
			
		||||
 | 
			
		||||
This demo was tested in the following deployments:
 | 
			
		||||
 | 
			
		||||
| V8 Version    | Platform     | OS Version   | Compiler       | Date       |
 | 
			
		||||
|:--------------|:-------------|:-------------|:---------------|:-----------|
 | 
			
		||||
| `11.3.244.11` | `darwin-x64` | macOS 13.2   | `clang 14.0.3` | 2023-05-20 |
 | 
			
		||||
| `11.3.244.11` | `darwin-arm` | macOS 13.0   | `clang 14.0.3` | 2023-06-05 |
 | 
			
		||||
| `11.3.244.11` | `linux-x64`  | HoloOS 3.4.6 | `gcc 12.2.0`   | 2023-05-20 |
 | 
			
		||||
| V8 Version    | Platform     | OS Version   | Compiler         | Date       |
 | 
			
		||||
|:--------------|:-------------|:-------------|:-----------------|:-----------|
 | 
			
		||||
| `11.8.82`     | `darwin-x64` | macOS 13.5.1 | `clang 14.0.3`   | 2023-08-26 |
 | 
			
		||||
| `11.8.82`     | `darwin-arm` | macOS 13.5.1 | `clang 14.0.3`   | 2023-08-26 |
 | 
			
		||||
| `11.8.82`     | `win10-x64`  | Windows 10   | `CL 19.37.32822` | 2023-08-26 |
 | 
			
		||||
| `11.3.244.11` | `linux-x64`  | HoloOS 3.4.6 | `gcc 12.2.0`     | 2023-05-20 |
 | 
			
		||||
 | 
			
		||||
:::
 | 
			
		||||
 | 
			
		||||
This program parses a file and prints CSV data from the first worksheet. It also
 | 
			
		||||
generates an XLSB file and writes to the filesystem.
 | 
			
		||||
 | 
			
		||||
:::caution
 | 
			
		||||
:::caution pass
 | 
			
		||||
 | 
			
		||||
When the demo was last tested, there were errors in the official V8 embed guide.
 | 
			
		||||
The correct instructions are included below.
 | 
			
		||||
 | 
			
		||||
:::
 | 
			
		||||
 | 
			
		||||
:::caution
 | 
			
		||||
:::caution pass
 | 
			
		||||
 | 
			
		||||
The build process is long and will test your patience.
 | 
			
		||||
 | 
			
		||||
@ -135,6 +149,9 @@ The build process is long and will test your patience.
 | 
			
		||||
 | 
			
		||||
### Preparation
 | 
			
		||||
 | 
			
		||||
<Tabs groupId="os">
 | 
			
		||||
  <TabItem value="unix" label="Linux/MacOS">
 | 
			
		||||
 | 
			
		||||
0) Prepare `/usr/local/lib`:
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
@ -142,7 +159,7 @@ mkdir -p /usr/local/lib
 | 
			
		||||
cd /usr/local/lib
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
:::caution
 | 
			
		||||
:::caution pass
 | 
			
		||||
 | 
			
		||||
If this step throws a permission error, run:
 | 
			
		||||
 | 
			
		||||
@ -153,15 +170,77 @@ sudo chmod 777 /usr/local/lib
 | 
			
		||||
 | 
			
		||||
:::
 | 
			
		||||
 | 
			
		||||
  </TabItem>
 | 
			
		||||
  <TabItem value="win" label="Windows">
 | 
			
		||||
 | 
			
		||||
0) Follow the official ["Visual Studio"](https://chromium.googlesource.com/chromium/src/+/master/docs/windows_build_instructions.md#visual-studio)
 | 
			
		||||
installation steps.
 | 
			
		||||
 | 
			
		||||
:::info pass
 | 
			
		||||
 | 
			
		||||
Using the installer tool, the "Desktop development with C++" workload must be
 | 
			
		||||
installed. In the sidebar, verify the following components are checked:
 | 
			
		||||
 | 
			
		||||
- "C++ ATL for latest ... build tools" (`v143` when last tested)
 | 
			
		||||
- "C++ MFC for latest ... build tools" (`v143` when last tested)
 | 
			
		||||
 | 
			
		||||
In the "Individual components" tab, search for "Windows 11 SDK" and verify that
 | 
			
		||||
"Windows 11 SDK (10.0.22621.0)" is checked.
 | 
			
		||||
 | 
			
		||||
Click "Modify" and allow the installer to finish.
 | 
			
		||||
 | 
			
		||||
The SDK debugging tools must be installed after the SDK is installed.
 | 
			
		||||
 | 
			
		||||
1) Using the Search bar, search "Apps & features".
 | 
			
		||||
 | 
			
		||||
2) When the setting panel opens, scroll down to "Windows Software Development
 | 
			
		||||
Kit - Windows 10.0.22621 and click "Modify".
 | 
			
		||||
 | 
			
		||||
3) In the new window, select "Change" and click "Next"
 | 
			
		||||
 | 
			
		||||
4) Check "Debugging Tools for Windows" and click "Change"
 | 
			
		||||
 | 
			
		||||
:::
 | 
			
		||||
 | 
			
		||||
The following `git` settings should be changed:
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
git config --global core.autocrlf false
 | 
			
		||||
git config --global core.filemode false
 | 
			
		||||
git config --global branch.autosetuprebase always
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
  </TabItem>
 | 
			
		||||
</Tabs>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
1) Download and install `depot_tools`:
 | 
			
		||||
 | 
			
		||||
<Tabs groupId="os">
 | 
			
		||||
  <TabItem value="unix" label="Linux/MacOS">
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
  </TabItem>
 | 
			
		||||
  <TabItem value="win" label="Windows">
 | 
			
		||||
 | 
			
		||||
[The bundle](https://storage.googleapis.com/chrome-infra/depot_tools.zip) is a
 | 
			
		||||
ZIP file that should be downloaded and extracted.
 | 
			
		||||
 | 
			
		||||
The demo was last tested on an exFAT-formatted drive (mounted at `E:\`).
 | 
			
		||||
 | 
			
		||||
After extracting, verify that the `depot_tools` folder is not read-only.
 | 
			
		||||
 | 
			
		||||
  </TabItem>
 | 
			
		||||
</Tabs>
 | 
			
		||||
 | 
			
		||||
2) Add the path to the `PATH` environment variable:
 | 
			
		||||
 | 
			
		||||
<Tabs groupId="os">
 | 
			
		||||
  <TabItem value="unix" label="Linux/MacOS">
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
export PATH="/usr/local/lib/depot_tools:$PATH"
 | 
			
		||||
```
 | 
			
		||||
@ -169,16 +248,91 @@ export PATH="/usr/local/lib/depot_tools:$PATH"
 | 
			
		||||
At this point, it is strongly recommended to add the line to a shell startup
 | 
			
		||||
script such as `.bashrc` or `.zshrc`
 | 
			
		||||
 | 
			
		||||
  </TabItem>
 | 
			
		||||
  <TabItem value="win" label="Windows">
 | 
			
		||||
 | 
			
		||||
:::caution pass
 | 
			
		||||
 | 
			
		||||
These instructions are for `cmd` use. Do not run in PowerShell!
 | 
			
		||||
 | 
			
		||||
It is strongly recommended to use the "Developer Command Prompt" from Visual
 | 
			
		||||
Studio as it prepares the console to run build tools.
 | 
			
		||||
 | 
			
		||||
:::
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
set DEPOT_TOOLS_WIN_TOOLCHAIN=0
 | 
			
		||||
set PATH=E:\depot_tools;%PATH%
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
In addition, the `vs2022_install` variable must be set to the Visual Studio
 | 
			
		||||
folder. For example, using the "Community Edition", the assignment should be
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
set vs2022_install="C:\Program Files\Microsoft Visual Studio\2022\Community"
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
These environment variables can be persisted in the Control Panel.
 | 
			
		||||
 | 
			
		||||
  </TabItem>
 | 
			
		||||
</Tabs>
 | 
			
		||||
 | 
			
		||||
3) Run `gclient` once to update `depot_tools`:
 | 
			
		||||
 | 
			
		||||
<Tabs groupId="os">
 | 
			
		||||
  <TabItem value="unix" label="Linux/MacOS">
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
gclient
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
  </TabItem>
 | 
			
		||||
  <TabItem value="win" label="Windows">
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
gclient
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
:::caution pass
 | 
			
		||||
 | 
			
		||||
`gclient` may throw errors related to `git` and permissions issues:
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
fatal: detected dubious ownership in repository at 'E:/depot_tools'
 | 
			
		||||
'E:/depot_tools' is on a file system that doesnot record ownership
 | 
			
		||||
To add an exception for this directory, call:
 | 
			
		||||
 | 
			
		||||
        git config --global --add safe.directory E:/depot_tools
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
These issues are related to the exFAT file system. They were resolved by running
 | 
			
		||||
the recommended commands and re-running `gclient`.
 | 
			
		||||
 | 
			
		||||
:::
 | 
			
		||||
 | 
			
		||||
:::caution pass
 | 
			
		||||
 | 
			
		||||
There were errors pertaining to `gitconfig`:
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
error: could not write config file E:/depot_tools/bootstrap-2@3_8_10_chromium_26_bin/git/etc/gitconfig: File exists
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
This can happen if the `depot_tools` folder is read-only. The workaround is to
 | 
			
		||||
unset the read-only flag for the `E:\depot_tools` folder.
 | 
			
		||||
 | 
			
		||||
:::
 | 
			
		||||
 | 
			
		||||
  </TabItem>
 | 
			
		||||
</Tabs>
 | 
			
		||||
 | 
			
		||||
### Clone V8
 | 
			
		||||
 | 
			
		||||
4) Create a base directory:
 | 
			
		||||
 | 
			
		||||
<Tabs groupId="os">
 | 
			
		||||
  <TabItem value="unix" label="Linux/MacOS">
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
mkdir -p ~/dev/v8
 | 
			
		||||
cd ~/dev/v8
 | 
			
		||||
@ -188,12 +342,94 @@ cd v8
 | 
			
		||||
 | 
			
		||||
Note that the actual repo will be placed in `~/dev/v8/v8`.
 | 
			
		||||
 | 
			
		||||
5) Checkout the desired version. The following command pulls `11.3.244.11`:
 | 
			
		||||
  </TabItem>
 | 
			
		||||
  <TabItem value="win" label="Windows">
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
git checkout refs/tags/11.3.244.11 -b sample -t
 | 
			
		||||
cd E:\
 | 
			
		||||
mkdir v8
 | 
			
		||||
cd v8
 | 
			
		||||
fetch v8
 | 
			
		||||
cd v8
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
:::caution pass
 | 
			
		||||
 | 
			
		||||
On exFAT, every cloned repo elicited the same `git` permissions error. `fetch`
 | 
			
		||||
will fail with a clear remedy message such as
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
        git config --global --add safe.directory E:/v8/v8
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Run the command then run `gclient sync`, repeating each time the command fails.
 | 
			
		||||
 | 
			
		||||
:::
 | 
			
		||||
 | 
			
		||||
:::caution pass
 | 
			
		||||
 | 
			
		||||
There were occasional `git` conflict errors:
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
v8/tools/clang (ERROR)
 | 
			
		||||
----------------------------------------
 | 
			
		||||
[0:00:01] Started.
 | 
			
		||||
...
 | 
			
		||||
error: Your local changes to the following files would be overwritten by checkout:
 | 
			
		||||
        plugins/FindBadRawPtrPatterns.cpp
 | 
			
		||||
...
 | 
			
		||||
Please commit your changes or stash them before you switch branches.
 | 
			
		||||
Aborting
 | 
			
		||||
error: could not detach HEAD
 | 
			
		||||
----------------------------------------
 | 
			
		||||
Error: 28> Unrecognized error, please merge or rebase manually.
 | 
			
		||||
28> cd E:\v8\v8\tools\clang && git rebase --onto 65ceb79efbc9d1dec9b1a0f4bc0b8d010b9d7a66 refs/remotes/origin/main
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
The recommended fix is to delete the referenced folder and re-run `gclient sync`
 | 
			
		||||
 | 
			
		||||
:::
 | 
			
		||||
 | 
			
		||||
  </TabItem>
 | 
			
		||||
</Tabs>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
5) Checkout the desired version. The following command pulls `11.8.82`:
 | 
			
		||||
 | 
			
		||||
<Tabs groupId="os">
 | 
			
		||||
  <TabItem value="unix" label="Linux/MacOS">
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
git checkout refs/tags/11.8.82 -b sample -t
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
  </TabItem>
 | 
			
		||||
  <TabItem value="win" label="Windows">
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
git checkout tags/11.8.82 -b sample
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
:::caution pass
 | 
			
		||||
 | 
			
		||||
The official documentation recommends:
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
git checkout refs/tags/11.8.82 -b sample -t
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
This command failed in local testing:
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
E:\v8\v8>git checkout refs/tags/11.8.82 -b sample -t
 | 
			
		||||
fatal: cannot set up tracking information; starting point 'refs/tags/11.8.82' is not a branch
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
:::
 | 
			
		||||
 | 
			
		||||
  </TabItem>
 | 
			
		||||
</Tabs>
 | 
			
		||||
 | 
			
		||||
### Build V8
 | 
			
		||||
 | 
			
		||||
6) Build the static library.
 | 
			
		||||
@ -214,6 +450,54 @@ tools/dev/v8gen.py arm64.release.sample
 | 
			
		||||
ninja -C out.gn/arm64.release.sample v8_monolith
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
  </TabItem>
 | 
			
		||||
  <TabItem value="win10-x64" label="Windows">
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
python3 tools\dev\v8gen.py -vv x64.release.sample
 | 
			
		||||
ninja -C out.gn\x64.release.sample v8_monolith
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
:::caution pass
 | 
			
		||||
 | 
			
		||||
In local testing, the build sometimes failed with a `dbghelp.dll` error:
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
 Exception: dbghelp.dll not found in "C:\Program Files (x86)\Windows Kits\10\Debuggers\x64\dbghelp.dll"
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
This issue was fixed by removing and reinstalling "Debugging Tools for Windows"
 | 
			
		||||
from the Control Panel as described in step 0.
 | 
			
		||||
 | 
			
		||||
:::
 | 
			
		||||
 | 
			
		||||
:::caution pass
 | 
			
		||||
 | 
			
		||||
In local testing, the `ninja` build failed with C++ deprecation errors:
 | 
			
		||||
 | 
			
		||||
```c++
 | 
			
		||||
../..\src/wasm/wasm-code-manager.h(789,28): error: 'atomic_load<v8::base::OwnedVector<const unsigned char>>' is deprecated: warning STL4029: std::atomic_*() overloads for shared_ptr are deprecated in C++20. The shared_ptr specialization of std::atomic provides superior functionality. You can define _SILENCE_CXX20_OLD_SHARED_PTR_ATOMIC_SUPPORT_DEPRECATION_WARNING or _SILENCE_ALL_CXX20_DEPRECATION_WARNINGS to suppress this warning. [-Werror,-Wdeprecated-declarations]
 | 
			
		||||
  789 |     auto wire_bytes = std::atomic_load(&wire_bytes_);
 | 
			
		||||
      |                            ^
 | 
			
		||||
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.37.32822\include\memory(3794,1): note: 'atomic_load<v8::base::OwnedVector<const unsigned char>>' has been explicitly marked deprecated here
 | 
			
		||||
 3794 | _CXX20_DEPRECATE_OLD_SHARED_PTR_ATOMIC_SUPPORT _NODISCARD shared_ptr<_Ty> atomic_load(
 | 
			
		||||
      | ^
 | 
			
		||||
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.37.32822\include\yvals_core.h(1317,7): note: expanded from macro '_CXX20_DEPRECATE_OLD_SHARED_PTR_ATOMIC_SUPPORT'
 | 
			
		||||
 1317 |     [[deprecated("warning STL4029: "                                                                \
 | 
			
		||||
      |       ^
 | 
			
		||||
2 errors generated.
 | 
			
		||||
[14/1303] CXX obj/torque_generated_definitions/js-atomics-synchronization-tq.obj
 | 
			
		||||
FAILED: obj/torque_generated_definitions/js-atomics-synchronization-tq.obj
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
The workaround is to append a line to `out.gn\x64.release.sample\args.gn`:
 | 
			
		||||
 | 
			
		||||
```text title="out.gn\x64.release.sample\args.gn (add to end)"
 | 
			
		||||
treat_warnings_as_errors = false
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
:::
 | 
			
		||||
 | 
			
		||||
  </TabItem>
 | 
			
		||||
</Tabs>
 | 
			
		||||
 | 
			
		||||
@ -237,6 +521,14 @@ g++ -I. -Iinclude samples/hello-world.cc -o hello_world -fno-rtti -lv8_monolith
 | 
			
		||||
    -lv8_libbase -lv8_libplatform -ldl -Lout.gn/arm64.release.sample/obj/ -pthread \
 | 
			
		||||
    -std=c++17 -DV8_COMPRESS_POINTERS=1 -DV8_ENABLE_SANDBOX
 | 
			
		||||
./hello_world
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
  </TabItem>
 | 
			
		||||
  <TabItem value="win10-x64" label="Windows">
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
cl /I. /Iinclude samples/hello-world.cc /GR- v8_monolith.lib Advapi32.lib Winmm.lib Dbghelp.lib /std:c++17 /DV8_COMPRESS_POINTERS=1 /DV8_ENABLE_SANDBOX /link /out:hello_world.exe /LIBPATH:out.gn\x64.release.sample\obj\
 | 
			
		||||
.\hello_world.exe
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
  </TabItem>
 | 
			
		||||
@ -247,14 +539,32 @@ g++ -I. -Iinclude samples/hello-world.cc -o hello_world -fno-rtti -lv8_monolith
 | 
			
		||||
 | 
			
		||||
8) Make a new project folder:
 | 
			
		||||
 | 
			
		||||
<Tabs groupId="os">
 | 
			
		||||
  <TabItem value="unix" label="Linux/MacOS">
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
cd ~/dev
 | 
			
		||||
mkdir -p sheetjs-v8
 | 
			
		||||
cd sheetjs-v8
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
  </TabItem>
 | 
			
		||||
  <TabItem value="win" label="Windows">
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
cd E:\
 | 
			
		||||
mkdir sheetjs-v8
 | 
			
		||||
cd sheetjs-v8
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
  </TabItem>
 | 
			
		||||
</Tabs>
 | 
			
		||||
 | 
			
		||||
9) Copy the sample source:
 | 
			
		||||
 | 
			
		||||
<Tabs groupId="os">
 | 
			
		||||
  <TabItem value="unix" label="Linux/MacOS">
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
cp ~/dev/v8/v8/samples/hello-world.cc .
 | 
			
		||||
```
 | 
			
		||||
@ -280,8 +590,23 @@ ln -s ~/dev/v8/v8/out.gn/arm64.release.sample/obj
 | 
			
		||||
  </TabItem>
 | 
			
		||||
</Tabs>
 | 
			
		||||
 | 
			
		||||
  </TabItem>
 | 
			
		||||
  <TabItem value="win" label="Windows">
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
copy E:\v8\v8\samples\hello-world.cc .\
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
10) Observe that exFAT does not support symbolic links and move on to step 11.
 | 
			
		||||
 | 
			
		||||
  </TabItem>
 | 
			
		||||
</Tabs>
 | 
			
		||||
 | 
			
		||||
11) Build and run the `hello-world` example from this folder:
 | 
			
		||||
 | 
			
		||||
<Tabs groupId="os">
 | 
			
		||||
  <TabItem value="unix" label="Linux/MacOS">
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
g++ -I. -Iinclude hello-world.cc -o hello_world -fno-rtti -lv8_monolith \
 | 
			
		||||
    -lv8_libbase -lv8_libplatform -ldl -Lobj/ -pthread -std=c++17 \
 | 
			
		||||
@ -289,6 +614,17 @@ g++ -I. -Iinclude hello-world.cc -o hello_world -fno-rtti -lv8_monolith \
 | 
			
		||||
./hello_world
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
  </TabItem>
 | 
			
		||||
  <TabItem value="win" label="Windows">
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
cl /MT /I..\v8\v8\ /I..\v8\v8\include hello-world.cc /GR- v8_monolith.lib Advapi32.lib Winmm.lib Dbghelp.lib /std:c++17 /DV8_COMPRESS_POINTERS=1 /DV8_ENABLE_SANDBOX /link /out:hello_world.exe /LIBPATH:..\v8\v8\out.gn\x64.release.sample\obj\
 | 
			
		||||
.\hello_world.exe
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
  </TabItem>
 | 
			
		||||
</Tabs>
 | 
			
		||||
 | 
			
		||||
### Add SheetJS
 | 
			
		||||
 | 
			
		||||
12) Download the standalone script and test file:
 | 
			
		||||
@ -311,18 +647,44 @@ curl -LO https://docs.sheetjs.com/v8/sheetjs.v8.cc
 | 
			
		||||
 | 
			
		||||
14) Compile standalone `sheetjs.v8` binary
 | 
			
		||||
 | 
			
		||||
<Tabs groupId="os">
 | 
			
		||||
  <TabItem value="unix" label="Linux/MacOS">
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
g++ -I. -Iinclude sheetjs.v8.cc -o sheetjs.v8 -fno-rtti -lv8_monolith \
 | 
			
		||||
    -lv8_libbase -lv8_libplatform -ldl -Lobj/ -pthread -std=c++17 \
 | 
			
		||||
    -DV8_COMPRESS_POINTERS=1 -DV8_ENABLE_SANDBOX
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
  </TabItem>
 | 
			
		||||
  <TabItem value="win" label="Windows">
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
cl /MT /I..\v8\v8\ /I..\v8\v8\include sheetjs.v8.cc /GR- v8_monolith.lib Advapi32.lib Winmm.lib Dbghelp.lib /std:c++17 /DV8_COMPRESS_POINTERS=1 /DV8_ENABLE_SANDBOX /link /out:sheetjs.v8.exe /LIBPATH:..\v8\v8\out.gn\x64.release.sample\obj\
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
  </TabItem>
 | 
			
		||||
</Tabs>
 | 
			
		||||
 | 
			
		||||
15) Run the demo:
 | 
			
		||||
 | 
			
		||||
<Tabs groupId="os">
 | 
			
		||||
  <TabItem value="unix" label="Linux/MacOS">
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
./sheetjs.v8 pres.numbers
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
  </TabItem>
 | 
			
		||||
  <TabItem value="win" label="Windows">
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
cl /MT /I..\v8\v8\ /I..\v8\v8\include sheetjs.v8.cc /GR- v8_monolith.lib Advapi32.lib Winmm.lib Dbghelp.lib /std:c++17 /DV8_COMPRESS_POINTERS=1 /DV8_ENABLE_SANDBOX /link /out:sheetjs.v8.exe /LIBPATH:..\v8\v8\out.gn\x64.release.sample\obj\
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
  </TabItem>
 | 
			
		||||
</Tabs>
 | 
			
		||||
 | 
			
		||||
If the program succeeded, the CSV contents will be printed to console and the
 | 
			
		||||
file `sheetjsw.xlsb` will be created.  That file can be opened with Excel.
 | 
			
		||||
 | 
			
		||||
@ -358,7 +720,7 @@ This demo was last tested in the following deployments:
 | 
			
		||||
 | 
			
		||||
| Architecture | V8 Crate | Date       |
 | 
			
		||||
|:-------------|:---------|:-----------|
 | 
			
		||||
| `darwin-x64` | `0.71.2` | 2023-05-22 |
 | 
			
		||||
| `darwin-x64` | `0.75.1` | 2023-08-26 |
 | 
			
		||||
| `darwin-arm` | `0.73.0` | 2023-06-05 |
 | 
			
		||||
| `linux-x64`  | `0.71.2` | 2023-05-23 |
 | 
			
		||||
| `win10-x64`  | `0.71.2` | 2023-05-23 |
 | 
			
		||||
 | 
			
		||||
@ -120,13 +120,14 @@ This demo was tested in the following deployments:
 | 
			
		||||
 | 
			
		||||
| Architecture | Git Commit | Date       |
 | 
			
		||||
|:-------------|:-----------|:-----------|
 | 
			
		||||
| `darwin-x64` | `c3ead3f`  | 2023-07-05 |
 | 
			
		||||
| `darwin-arm` | `c3ead3f`  | 2023-07-05 |
 | 
			
		||||
| `darwin-x64` | `c3ead3f`  | 2023-08-26 |
 | 
			
		||||
| `darwin-arm` | `c3ead3f`  | 2023-08-26 |
 | 
			
		||||
| `win10-x64`  | `c3ead3f`  | 2023-08-26 |
 | 
			
		||||
| `linux-x64`  | `c3ead3f`  | 2023-07-05 |
 | 
			
		||||
 | 
			
		||||
:::
 | 
			
		||||
 | 
			
		||||
0) Install `icu` and `cmake` dependencies.
 | 
			
		||||
0) Install dependencies:
 | 
			
		||||
 | 
			
		||||
<Tabs groupId="triple">
 | 
			
		||||
  <TabItem value="darwin-x64" label="Intel Mac">
 | 
			
		||||
@ -151,13 +152,19 @@ On Arch Linux / HoloOS:
 | 
			
		||||
sudo pacman -S cmake clang
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
  </TabItem>
 | 
			
		||||
  <TabItem value="win10-x64" label="Windows">
 | 
			
		||||
 | 
			
		||||
Install Visual Studio 2022 with the "Desktop Development with C++" workflow.
 | 
			
		||||
All commands in this demo should be run in a Developer Command Prompt.
 | 
			
		||||
 | 
			
		||||
  </TabItem>
 | 
			
		||||
</Tabs>
 | 
			
		||||
 | 
			
		||||
1) Download ChakraCore:
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
git clone https://github.com/Microsoft/ChakraCore
 | 
			
		||||
git clone https://github.com/Microsoft/ChakraCore.git
 | 
			
		||||
cd ChakraCore
 | 
			
		||||
git checkout c3ead3f
 | 
			
		||||
cd ..
 | 
			
		||||
@ -241,6 +248,31 @@ When the demo was last tested, ChakraCore JIT was not supported.
 | 
			
		||||
cd ChakraCore
 | 
			
		||||
./build.sh --static --embed-icu --test-build -j=8 --no-jit
 | 
			
		||||
cd ..
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
  </TabItem>
 | 
			
		||||
  <TabItem value="win10-x64" label="Windows">
 | 
			
		||||
 | 
			
		||||
:::info pass
 | 
			
		||||
 | 
			
		||||
As explained in the ChakraCore project wiki[^1], the build accepts a few flags:
 | 
			
		||||
 | 
			
		||||
- `/p:Platform=x64` controls the architecture
 | 
			
		||||
- `/p:Configuration=Debug` enables runtime checks
 | 
			
		||||
- `/p:RuntimeLib=static_library` ensures MSVC libraries are statically linked
 | 
			
		||||
 | 
			
		||||
:::
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
cd ChakraCore
 | 
			
		||||
msbuild /m /p:Platform=x64 /p:Configuration=Debug /p:RuntimeLib=static_library Build\Chakra.Core.sln
 | 
			
		||||
cd ..
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
After building, the generated DLL should be copied into the project folder:
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
copy .\ChakraCore\Build\VcBuild\bin\x64_debug\ChakraCore.dll .
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
  </TabItem>
 | 
			
		||||
@ -252,18 +284,19 @@ cd ..
 | 
			
		||||
- [`Makefile`](pathname:///chakra/Makefile)
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
curl -LO https://docs.sheetjs.com/chakra/sheetjs.ch.cpp
 | 
			
		||||
curl -LO https://docs.sheetjs.com/chakra/Makefile
 | 
			
		||||
curl -L -O https://docs.sheetjs.com/chakra/sheetjs.ch.cpp
 | 
			
		||||
curl -L -O https://docs.sheetjs.com/chakra/Makefile
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
4) Build the sample application:
 | 
			
		||||
 | 
			
		||||
<Tabs groupId="os">
 | 
			
		||||
  <TabItem value="unix" label="Linux/MacOS">
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
make
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
This program tries to parse the file specified by the first argument
 | 
			
		||||
 | 
			
		||||
:::caution
 | 
			
		||||
 | 
			
		||||
When this demo was last tested on macOS, the build failed with the message:
 | 
			
		||||
@ -283,6 +316,16 @@ sudo ln -s /opt/homebrew/opt/icu4c
 | 
			
		||||
 | 
			
		||||
:::
 | 
			
		||||
 | 
			
		||||
  </TabItem>
 | 
			
		||||
  <TabItem value="win" label="Windows">
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
cl sheetjs.ch.cpp ChakraCore.lib /I ChakraCore\lib\Jsrt /link /LIBPATH:ChakraCore\Build\VcBuild\bin\x64_debug
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
  </TabItem>
 | 
			
		||||
</Tabs>
 | 
			
		||||
 | 
			
		||||
5) Download the standalone script, shim script, and test file:
 | 
			
		||||
 | 
			
		||||
<ul>
 | 
			
		||||
@ -292,17 +335,30 @@ sudo ln -s /opt/homebrew/opt/icu4c
 | 
			
		||||
</ul>
 | 
			
		||||
 | 
			
		||||
<CodeBlock language="bash">{`\
 | 
			
		||||
curl -LO https://cdn.sheetjs.com/xlsx-${current}/package/dist/xlsx.full.min.js
 | 
			
		||||
curl -LO https://cdn.sheetjs.com/xlsx-${current}/package/dist/shim.min.js
 | 
			
		||||
curl -LO https://sheetjs.com/pres.numbers`}
 | 
			
		||||
curl -L -O https://cdn.sheetjs.com/xlsx-${current}/package/dist/xlsx.full.min.js
 | 
			
		||||
curl -L -O https://cdn.sheetjs.com/xlsx-${current}/package/dist/shim.min.js
 | 
			
		||||
curl -L -O https://sheetjs.com/pres.numbers`}
 | 
			
		||||
</CodeBlock>
 | 
			
		||||
 | 
			
		||||
6) Run the test program:
 | 
			
		||||
 | 
			
		||||
<Tabs groupId="os">
 | 
			
		||||
  <TabItem value="unix" label="Linux/MacOS">
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
./sheetjs.ch pres.numbers
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
  </TabItem>
 | 
			
		||||
  <TabItem value="win" label="Windows">
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
.\sheetjs.ch.exe pres.numbers
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
  </TabItem>
 | 
			
		||||
</Tabs>
 | 
			
		||||
 | 
			
		||||
If successful, the program will print the contents of the first sheet as CSV.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -310,8 +366,7 @@ If successful, the program will print the contents of the first sheet as CSV.
 | 
			
		||||
 | 
			
		||||
:::note
 | 
			
		||||
 | 
			
		||||
This demo was last tested on 2023 April 09 against `ch` `1.13.0.0-beta`.
 | 
			
		||||
The command line tool was built against commit `c3ead3f`.
 | 
			
		||||
This demo was last tested on 2023-08-26 against `ch` commit `c3ead3f`.
 | 
			
		||||
 | 
			
		||||
:::
 | 
			
		||||
 | 
			
		||||
@ -321,6 +376,13 @@ file as a Base64 string and directly add it to an amalgamated script.
 | 
			
		||||
0) Download and extract the ChakraCore release ZIP.  Copy the binary (`bin/ch`)
 | 
			
		||||
to your project folder.
 | 
			
		||||
 | 
			
		||||
:::note pass
 | 
			
		||||
 | 
			
		||||
The ["Integration Example"](#integration-example) also builds the `ch` binary!
 | 
			
		||||
It will typically be placed in the `ChakraCore/out/Test/` folder.
 | 
			
		||||
 | 
			
		||||
:::
 | 
			
		||||
 | 
			
		||||
1) Download the standalone script, shim, and test file:
 | 
			
		||||
 | 
			
		||||
<ul>
 | 
			
		||||
@ -329,6 +391,12 @@ to your project folder.
 | 
			
		||||
<li><a href="https://sheetjs.com/pres.numbers">pres.numbers</a></li>
 | 
			
		||||
</ul>
 | 
			
		||||
 | 
			
		||||
<CodeBlock language="bash">{`\
 | 
			
		||||
curl -L -O https://cdn.sheetjs.com/xlsx-${current}/package/dist/xlsx.full.min.js
 | 
			
		||||
curl -L -O https://cdn.sheetjs.com/xlsx-${current}/package/dist/shim.min.js
 | 
			
		||||
curl -L -O https://sheetjs.com/pres.numbers`}
 | 
			
		||||
</CodeBlock>
 | 
			
		||||
 | 
			
		||||
2) Bundle the test file and create `payload.js`:
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
@ -364,3 +432,5 @@ ready, it will read the bundled test data and print the contents as CSV.
 | 
			
		||||
```bash
 | 
			
		||||
./ch xlsx.chakra.js
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
[^1]: See ["Building ChakraCore"](https://github.com/chakra-core/ChakraCore/wiki/Building-ChakraCore#deployment) in the ChakraCore project wiki
 | 
			
		||||
@ -1,6 +1,6 @@
 | 
			
		||||
---
 | 
			
		||||
title: Sheet Visibility
 | 
			
		||||
sidebar_position: 7
 | 
			
		||||
sidebar_position: 10
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
<details>
 | 
			
		||||
@ -8,6 +8,8 @@ The official source code repository is <https://git.sheetjs.com/sheetjs/sheetjs>
 | 
			
		||||
 | 
			
		||||
Issues should be raised at <https://git.sheetjs.com/sheetjs/sheetjs/issues>
 | 
			
		||||
 | 
			
		||||
Issues can also be reported on [our Discord server](https://sheetjs.com/chat)
 | 
			
		||||
 | 
			
		||||
The official changelog can be found [in the source code repository](https://git.sheetjs.com/sheetjs/sheetjs/raw/branch/master/CHANGELOG.md)
 | 
			
		||||
 | 
			
		||||
:::tip pass
 | 
			
		||||
 | 
			
		||||
@ -16,12 +16,13 @@ static char *read_file(const char *filename, size_t *sz) {
 | 
			
		||||
  return buf;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
v8::Local<v8::Value> eval_code(v8::Isolate *isolate, v8::Local<v8::Context> context, char* code) {
 | 
			
		||||
  v8::Local<v8::String> source = v8::String::NewFromUtf8(isolate, code).ToLocalChecked();
 | 
			
		||||
v8::Local<v8::Value> eval_code(v8::Isolate *isolate, v8::Local<v8::Context> context, char* code, size_t sz = -1) {
 | 
			
		||||
  v8::Local<v8::String> source = v8::String::NewFromUtf8(isolate, code, v8::NewStringType::kNormal, sz).ToLocalChecked();
 | 
			
		||||
  v8::Local<v8::Script> script = v8::Script::Compile(context, source).ToLocalChecked();
 | 
			
		||||
  return script->Run(context).ToLocalChecked();
 | 
			
		||||
}
 | 
			
		||||
#define EVAL_CODE(x) eval_code(isolate, context, (char *)x)
 | 
			
		||||
#define EVAL_CODE2(x,sz) eval_code(isolate, context, (char *)x, sz)
 | 
			
		||||
 | 
			
		||||
int main(int argc, char* argv[]) {
 | 
			
		||||
  /* initialize -- this part is from the hello world example */
 | 
			
		||||
@ -47,7 +48,7 @@ int main(int argc, char* argv[]) {
 | 
			
		||||
      if(!file) { perror("Error reading xlsx.full.min.js"); return 1; }
 | 
			
		||||
 | 
			
		||||
      /* evaluate */
 | 
			
		||||
      v8::Local<v8::Value> result = EVAL_CODE(file);
 | 
			
		||||
      v8::Local<v8::Value> result = EVAL_CODE2(file, sz);
 | 
			
		||||
 | 
			
		||||
      /* free */
 | 
			
		||||
      free(file);
 | 
			
		||||
 | 
			
		||||
										
											Binary file not shown.
										
									
								
							| 
		 Before Width: | Height: | Size: 302 KiB After Width: | Height: | Size: 40 KiB  | 
										
											Binary file not shown.
										
									
								
							| 
		 Before Width: | Height: | Size: 172 KiB After Width: | Height: | Size: 122 KiB  | 
										
											Binary file not shown.
										
									
								
							| 
		 Before Width: | Height: | Size: 59 KiB After Width: | Height: | Size: 64 KiB  | 
		Loading…
	
		Reference in New Issue
	
	Block a user