From c78829079f12a44e95d35d1ae92c16fea903b3d9 Mon Sep 17 00:00:00 2001
From: SheetJS <dev@sheetjs.com>
Date: Wed, 22 Jun 2022 15:25:24 -0400
Subject: [PATCH] sapui5

---
 docz/docs/02-installation/04-nodejs.md        |  2 +-
 docz/docs/02-installation/06-amd.md           | 36 +++++++++++++++++-
 .../04-getting-started/03-demos/03-excel.md   |  2 +-
 docz/docs/05-interface.md                     | 38 ++++++++++++++++---
 4 files changed, 70 insertions(+), 8 deletions(-)

diff --git a/docz/docs/02-installation/04-nodejs.md b/docz/docs/02-installation/04-nodejs.md
index bce55ba..c4e659c 100644
--- a/docz/docs/02-installation/04-nodejs.md
+++ b/docz/docs/02-installation/04-nodejs.md
@@ -63,7 +63,7 @@ $ pnpm install --save file:vendor/xlsx-${current}.tgz`}
   </TabItem>
   <TabItem value="yarn" label="Yarn" default>
 <pre><code parentName="pre" {...{"className": "language-bash"}}>{`\
-$ yarn add --save file:vendor/xlsx-0.18.7.tgz`}
+$ yarn add --save file:vendor/xlsx-${current}.tgz`}
 </code></pre>
   </TabItem>
 </Tabs>
diff --git a/docz/docs/02-installation/06-amd.md b/docz/docs/02-installation/06-amd.md
index 39d27a4..3466369 100644
--- a/docz/docs/02-installation/06-amd.md
+++ b/docz/docs/02-installation/06-amd.md
@@ -1,7 +1,7 @@
 ---
 sidebar_position: 6
 sidebar_custom_props:
-  summary: NetSuite, RequireJS and other module systems
+  summary: NetSuite, SAP UI5, RequireJS
 ---
 
 import current from '/version.js';
@@ -14,6 +14,15 @@ Each standalone release script is available at <https://cdn.sheetjs.com/>.
 
 <div><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> is the URL for {current}</div><br/>
 
+:::note
+
+When referencing by file name, AMD loaders typically omit the file extension.
+
+The actual file name is `xlsx.full.min.js`, but the examples will refer to the
+script as `xlsx.full.min`.
+
+:::
+
 ## NetSuite
 
 After downloading the script, it can be referenced directly in `define` calls
@@ -28,6 +37,31 @@ define(['N/file', './xlsx.full.min'], function(file, XLSX) {
 As explained in the [NetSuite demo](../getting-started/demos/netsuite), module
 aliases are created in config files referenced via `@NAmdConfig` comments.
 
+## SAP UI5
+
+After downloading the script, it can be uploaded to the UI5 project and loaded
+in the `sap.ui.define` call:
+
+```js
+sap.ui.define([
+  /* ... other libraries ... */
+  "path/to/xlsx.full.min"
+], function(/* ... variables for the other libraries ... */, XLSX) {
+  // use XLSX here
+})
+```
+
+:::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)
+It recommends copying and pasting JavaScript code.
+
+**Copy and pasting code does not work** for SheetJS scripts as they contain
+Unicode characters that may be mangled.  The standalone script should be
+downloaded and manually uploaded to the project.
+
+:::
+
 ## RequireJS
 
 After downloading the script, it can be referenced directly in `require` calls:
diff --git a/docz/docs/04-getting-started/03-demos/03-excel.md b/docz/docs/04-getting-started/03-demos/03-excel.md
index a4b0687..1da8041 100644
--- a/docz/docs/04-getting-started/03-demos/03-excel.md
+++ b/docz/docs/04-getting-started/03-demos/03-excel.md
@@ -156,7 +156,7 @@ var wb = XLSX.read(ab); // parse workbook
 
 **This is how it should work**.
 
-[There are outstanding bugs](https://github.com/OfficeDev/office-js/issues/2186)
+[There are outstanding bugs in Excel.](https://github.com/OfficeDev/office-js/issues/2186)
 
 For the purposes of this demo, a Base64-encoded file will be used.  The
 workaround involves fetching that Base64 file, getting the text, and parsing
diff --git a/docz/docs/05-interface.md b/docz/docs/05-interface.md
index 0106a4e..84ec4ad 100644
--- a/docz/docs/05-interface.md
+++ b/docz/docs/05-interface.md
@@ -10,6 +10,8 @@ sidebar_position: 5
 
 `XLSX.SSF` is an embedded version of the [format library](https://github.com/SheetJS/sheetjs/tree/master/packages/ssf).
 
+`XLSX.CFB` is an embedded version of the [container library](https://github.com/sheetjs/js-cfb).
+
 ## Parsing functions
 
 `XLSX.read(data, read_opts)` attempts to parse `data`.
@@ -20,16 +22,18 @@ Parse options are described in the [Parsing Options](./api/parse-options) sectio
 
 ## Writing functions
 
-`XLSX.write(wb, write_opts)` attempts to write the workbook `wb`
+`XLSX.write(wb, write_opts)` attempts to write the workbook `wb`.
+
+`XLSX.writeXLSX(wb, write_opts)` attempts to write the workbook in XLSX format.
 
 `XLSX.writeFile(wb, filename, write_opts)` attempts to write `wb` to `filename`.
 In browser-based environments, it will attempt to force a client-side download.
 
+`XLSX.writeFileXLSX(wb, filename, write_opts)` attempts to write an XLSX file.
+
 `XLSX.writeFileAsync(filename, wb, o, cb)` attempts to write `wb` to `filename`.
 If `o` is omitted, the writer will use the third argument as the callback.
 
-`XLSX.stream` contains a set of streaming write functions.
-
 Write options are described in the [Writing Options](./api/write-options) section.
 
 ## Utilities
@@ -59,7 +63,7 @@ The following are described in the [Utility Functions](./api/utilities):
 - `table_to_sheet` converts a DOM TABLE element to a worksheet.
 - `sheet_add_aoa` adds an array of arrays of JS data to an existing worksheet.
 - `sheet_add_json` adds an array of JS objects to an existing worksheet.
-
+- `sheet_add_dom` adds data from a DOM TABLE element to an existing worksheet.
 
 **Exporting:**
 
@@ -69,7 +73,31 @@ The following are described in the [Utility Functions](./api/utilities):
 - `sheet_to_html` generates HTML output.
 - `sheet_to_formulae` generates a list of the formulae (with value fallbacks).
 
-
 **Miscellaneous**
 
 - `format_cell` generates the text value for a cell (using number formats).
+- `sheet_set_array_formula` adds an array formula to a worksheet
+
+## Platform-Specific Functions
+
+### NodeJS Streaming Write functions
+
+`XLSX.stream` contains a set of streaming write functions for NodeJS streams:
+
+- `to_csv(sheet, opts)` streams CSV rows
+- `to_html(sheet, opts)` streams an HTML table incrementally
+- `to_json(sheet, opts)` streams JS objects (object-mode stream)
+
+### ESM Helpers
+
+Due to broad inconsistencies in ESM implementations, the `mjs` build does not
+import any dependencies.  Instead, they must be manually passed to the library:
+
+`XLSX.set_cptable` sets the internal `codepage` instance.  This provides support
+for different language encodings.
+
+`XLSX.set_fs` set `fs` instance (using `readFileSync` and `writeFileSync`). This
+provides NodeJS ESM support for `XLSX.readFile` and `XLSX.writeFile`.
+
+`XLSX.utils.set_readable` supplies a NodeJS `stream.Readable` constructor.  This
+provides NodeJS ESM support for the streaming operations.
\ No newline at end of file