diff --git a/docz/docs/08-api/07-utilities/05-csv.md b/docz/docs/08-api/07-utilities/05-csv.md index 78c92bb..e31f1dc 100644 --- a/docz/docs/08-api/07-utilities/05-csv.md +++ b/docz/docs/08-api/07-utilities/05-csv.md @@ -61,7 +61,7 @@ produces CSV output. The function takes an options argument: |`dateNF` | FMT 14 | Use specified date format in string output | |`strip` | false | Remove trailing field separators in each record ** | |`blankrows` | true | Include blank lines in the CSV output | -|`skipHidden` | false | Skips hidden rows/columns in the CSV output | +|`skipHidden` | `false` | [Skip hidden data](#hidden-rows-and-columns) | |`forceQuotes` | false | Force quotes around fields | - `strip` will remove trailing commas from each line under default `FS/RS` @@ -123,3 +123,52 @@ UTF-16 BOM will be added. If encoding support is not available, the output will be encoded as a standard `string`. `XLSX.utils.sheet_to_txt` takes the same arguments as `sheet_to_csv`. + +### Notes + +#### Hidden Rows and Columns + +By default, all rows and columns are rendered. The `skipHidden` option instructs +the text processor to skip hidden rows and columns. + +The worksheet [`!rows` array](/docs/csf/features/rowprops) stores row settings. +The [`!cols` array](/docs/csf/features/colprops) stores column settings. + +:::info pass + +By default, the `read` and `readFile` methods do not save row / column settings. +[The `cellStyles` option must be set](/docs/api/parse-options#parsing-options). + +::: + +The following demo shows the effect of `skipHidden`. Rows 2 and 5 and columns F +and G are marked as hidden. The hidden rows and columns are rendered by default +but omitted when the `skipHidden` option is set to `true`. + +```jsx live +function SheetJSCSVHiddenRows() { + var ws = XLSX.utils.aoa_to_sheet([ + ["S", "h", "e", "e", "t", "J", "S", "Hidden (row)"], + [ 1, 2, , , 5, 6, 7, true], + [ 2, 3, , , 6, 7, 8, false], + [ 3, 4, , , 7, 8, 9, false], + [ 4, 5, 6, 7, 8, 9, 0, true], + [ 0, 0, 0, 0, 0, 1, 1, false, "Hidden (col)"] + ]); + + ws["!rows"] = []; + ws["!rows"][1] = { hidden: true, hpx: 16 }; // hide row 2 + ws["!rows"][4] = { hidden: true, hpx: 16 }; // hide row 5 + + ws["!cols"] = []; + ws["!cols"][5] = { wch: 8, hidden: true }; // hide column F + ws["!cols"][6] = { wch: 8, hidden: true }; // hide column G + + return (
+    Worksheet data (as HTML)
+    
+ XLSX.utils.sheet_to_csv(ws, {'{'} skipHidden: true {'}'})
+ {XLSX.utils.sheet_to_csv(ws, { skipHidden: true })}
+
); +} +``` diff --git a/docz/docs/12-constellation/02-frac.md b/docz/docs/12-constellation/02-frac.md index 7fe0a18..1f7afe8 100644 --- a/docz/docs/12-constellation/02-frac.md +++ b/docz/docs/12-constellation/02-frac.md @@ -27,6 +27,8 @@ function SheetJSFrac() { const [val, setVal] = React.useState(0.6994); const [text, setText] = React.useState(""); + if(typeof frac == "undefined") return ( ERROR: Reload this page ); + const fmt = arr => `${(""+arr[1]).padStart(3)} / ${(""+arr[2]).padEnd(3)}`; React.useEffect(() => { if(typeof frac == "undefined") return setText("ERROR: Reload this page!"); @@ -93,7 +95,7 @@ processing involving fractions and numeric data. Both functions accept three arguments: ```js -var fract_mediant = frac(value, denominator, mixed); +var frac_mediant = frac(value, denominator, mixed); var frac_cont = frac.cont(value, denominator, mixed); ```