1 | [![view on npm](http://img.shields.io/npm/v/xlsx-populate.svg)](https://www.npmjs.org/package/xlsx-populate)
|
2 | [![npm module downloads per month](http://img.shields.io/npm/dm/xlsx-populate.svg)](https://www.npmjs.org/package/xlsx-populate)
|
3 | [![Build Status](https://travis-ci.org/dtjohnson/xlsx-populate.svg?branch=master)](https://travis-ci.org/dtjohnson/xlsx-populate)
|
4 | [![Dependency Status](https://david-dm.org/dtjohnson/xlsx-populate.svg)](https://david-dm.org/dtjohnson/xlsx-populate)
|
5 |
|
6 | # xlsx-populate
|
7 | Excel XLSX parser/generator written in JavaScript with Node.js and browser support, jQuery/d3-style method chaining, encryption, and a focus on keeping existing workbook features and styles in tact.
|
8 |
|
9 | ## Table of Contents
|
10 | - [Installation](#installation)
|
11 | * [Node.js](#nodejs)
|
12 | * [Browser](#browser)
|
13 | - [Usage](#usage)
|
14 | * [Populating Data](#populating-data)
|
15 | * [Parsing Data](#parsing-data)
|
16 | * [Ranges](#ranges)
|
17 | * [Rows and Columns](#rows-and-columns)
|
18 | * [Managing Sheets](#managing-sheets)
|
19 | * [Defined Names](#defined-names)
|
20 | * [Find and Replace](#find-and-replace)
|
21 | * [Styles](#styles)
|
22 | * [Rich Texts](#rich-texts)
|
23 | + [Supported styles](#supported-styles)
|
24 | + [Usage](#usage-1)
|
25 | + [Notes](#notes)
|
26 | * [Dates](#dates)
|
27 | * [Data Validation](#data-validation)
|
28 | * [Method Chaining](#method-chaining)
|
29 | * [Hyperlinks](#hyperlinks)
|
30 | * [Print Options](#print-options)
|
31 | * [Page Margins](#page-margins)
|
32 | * [SheetView Panes](#sheetview-panes)
|
33 | * [Serving from Express](#serving-from-express)
|
34 | * [Browser Usage](#browser-usage)
|
35 | * [Promises](#promises)
|
36 | * [Encryption](#encryption)
|
37 | - [Missing Features](#missing-features)
|
38 | - [Submitting an Issue](#submitting-an-issue)
|
39 | - [Contributing](#contributing)
|
40 | * [How xlsx-populate Works](#how-xlsx-populate-works)
|
41 | * [Setting up your Environment](#setting-up-your-environment)
|
42 | * [Pull Request Checklist](#pull-request-checklist)
|
43 | * [Gulp Tasks](#gulp-tasks)
|
44 | - [Style Reference](#style-reference)
|
45 | - [API Reference](#api-reference)
|
46 |
|
47 | ## Installation
|
48 |
|
49 | ### Node.js
|
50 | ```bash
|
51 | npm install xlsx-populate
|
52 | ```
|
53 | Note that xlsx-populate uses ES6 features so only Node.js v4+ is supported.
|
54 |
|
55 | ### Browser
|
56 |
|
57 | A functional browser example can be found in [examples/browser/index.html](https://gitcdn.xyz/repo/dtjohnson/xlsx-populate/master/examples/browser/index.html).
|
58 |
|
59 | xlsx-populate is written first for Node.js. We use [browserify](http://browserify.org/) and [babelify](https://github.com/babel/babelify) to transpile and pack up the module for use in the browser.
|
60 |
|
61 | You have a number of options to include the code in the browser. You can download the combined, minified code from the browser directory in this repository or you can install with bower:
|
62 | ```bash
|
63 | bower install xlsx-populate
|
64 | ```
|
65 | After including the module in the browser, it is available globally as `XlsxPopulate`.
|
66 |
|
67 | Alternatively, you can require this module using [browserify](http://browserify.org/). Since xlsx-populate uses ES6 features, you will also need to use [babelify](https://github.com/babel/babelify) with [babel-preset-env](https://www.npmjs.com/package/babel-preset-env).
|
68 |
|
69 | ## Usage
|
70 |
|
71 | xlsx-populate has an [extensive API](#api-reference) for working with Excel workbooks. This section reviews the most common functions and use cases. Examples can also be found in the examples directory of the source code.
|
72 |
|
73 | ### Populating Data
|
74 |
|
75 | To populate data in a workbook, you first load one (either blank, from data, or from file). Then you can access sheets and
|
76 | cells within the workbook to manipulate them.
|
77 | ```js
|
78 | const XlsxPopulate = require('xlsx-populate');
|
79 |
|
80 | // Load a new blank workbook
|
81 | XlsxPopulate.fromBlankAsync()
|
82 | .then(workbook => {
|
83 | // Modify the workbook.
|
84 | workbook.sheet("Sheet1").cell("A1").value("This is neat!");
|
85 |
|
86 | // Write to file.
|
87 | return workbook.toFileAsync("./out.xlsx");
|
88 | });
|
89 | ```
|
90 |
|
91 | ### Parsing Data
|
92 |
|
93 | You can pull data out of existing workbooks using [Cell.value](#Cell+value) as a getter without any arguments:
|
94 | ```js
|
95 | const XlsxPopulate = require('xlsx-populate');
|
96 |
|
97 | // Load an existing workbook
|
98 | XlsxPopulate.fromFileAsync("./Book1.xlsx")
|
99 | .then(workbook => {
|
100 | // Modify the workbook.
|
101 | const value = workbook.sheet("Sheet1").cell("A1").value();
|
102 |
|
103 | // Log the value.
|
104 | console.log(value);
|
105 | });
|
106 | ```
|
107 | __Note__: in cells that contain values calculated by formulas, Excel will store the calculated value in the workbook. The [value](#Cell+value) method will return the value of the cells at the time the workbook was saved. xlsx-populate will _not_ recalculate the values as you manipulate the workbook and will _not_ write the values to the output.
|
108 |
|
109 | ### Ranges
|
110 | xlsx-populate also supports ranges of cells to allow parsing/manipulation of multiple cells at once.
|
111 | ```js
|
112 | const r = workbook.sheet(0).range("A1:C3");
|
113 |
|
114 | // Set all cell values to the same value:
|
115 | r.value(5);
|
116 |
|
117 | // Set the values using a 2D array:
|
118 | r.value([
|
119 | [1, 2, 3],
|
120 | [4, 5, 6],
|
121 | [7, 8, 9]
|
122 | ]);
|
123 |
|
124 | // Set the values using a callback function:
|
125 | r.value((cell, ri, ci, range) => Math.random());
|
126 | ```
|
127 |
|
128 | A common use case is to simply pull all of the values out all at once. You can easily do that with the [Sheet.usedRange](#Sheet+usedRange) method.
|
129 | ```js
|
130 | // Get 2D array of all values in the worksheet.
|
131 | const values = workbook.sheet("Sheet1").usedRange().value();
|
132 | ```
|
133 |
|
134 | Alternatively, you can set the values in a range with only the top-left cell in the range:
|
135 | ```js
|
136 | workbook.sheet(0).cell("A1").value([
|
137 | [1, 2, 3],
|
138 | [4, 5, 6],
|
139 | [7, 8, 9]
|
140 | ]);
|
141 | ```
|
142 | The set range is returned.
|
143 |
|
144 | ### Rows and Columns
|
145 |
|
146 | You can access rows and columns in order to change size, hide/show, or access cells within:
|
147 | ```js
|
148 | // Get the B column, set its width and unhide it (assuming it was hidden).
|
149 | sheet.column("B").width(25).hidden(false);
|
150 |
|
151 | const cell = sheet.row(5).cell(3); // Returns the cell at C5.
|
152 | ```
|
153 |
|
154 | ### Managing Sheets
|
155 | xlsx-populate supports a number of options for managing sheets.
|
156 |
|
157 | You can get a sheet by name or index or get all of the sheets as an array:
|
158 | ```js
|
159 | // Get sheet by index
|
160 | const sheet1 = workbook.sheet(0);
|
161 |
|
162 | // Get sheet by name
|
163 | const sheet2 = workbook.sheet("Sheet2");
|
164 |
|
165 | // Get all sheets as an array
|
166 | const sheets = workbook.sheets();
|
167 | ```
|
168 |
|
169 | You can add new sheets:
|
170 | ```js
|
171 | // Add a new sheet named 'New 1' at the end of the workbook
|
172 | const newSheet1 = workbook.addSheet('New 1');
|
173 |
|
174 | // Add a new sheet named 'New 2' at index 1 (0-based)
|
175 | const newSheet2 = workbook.addSheet('New 2', 1);
|
176 |
|
177 | // Add a new sheet named 'New 3' before the sheet named 'Sheet1'
|
178 | const newSheet3 = workbook.addSheet('New 3', 'Sheet1');
|
179 |
|
180 | // Add a new sheet named 'New 4' before the sheet named 'Sheet1' using a Sheet reference.
|
181 | const sheet = workbook.sheet('Sheet1');
|
182 | const newSheet4 = workbook.addSheet('New 4', sheet);
|
183 | ```
|
184 | *Note: the sheet rename method does not rename references to the sheet so formulas, etc. can be broken. Use with caution!*
|
185 |
|
186 | You can rename sheets:
|
187 | ```js
|
188 | // Rename the first sheet.
|
189 | const sheet = workbook.sheet(0).name("new sheet name");
|
190 | ```
|
191 |
|
192 | You can move sheets:
|
193 | ```js
|
194 | // Move 'Sheet1' to the end
|
195 | workbook.moveSheet("Sheet1");
|
196 |
|
197 | // Move 'Sheet1' to index 2
|
198 | workbook.moveSheet("Sheet1", 2);
|
199 |
|
200 | // Move 'Sheet1' before 'Sheet2'
|
201 | workbook.moveSheet("Sheet1", "Sheet2");
|
202 | ```
|
203 | The above methods can all use sheet references instead of names as well. And you can also move a sheet using a method on the sheet:
|
204 | ```js
|
205 | // Move the sheet before 'Sheet2'
|
206 | sheet.move("Sheet2");
|
207 | ```
|
208 |
|
209 | You can delete sheets:
|
210 | ```js
|
211 | // Delete 'Sheet1'
|
212 | workbook.deleteSheet("Sheet1");
|
213 |
|
214 | // Delete sheet with index 2
|
215 | workbook.deleteSheet(2);
|
216 |
|
217 | // Delete from sheet reference
|
218 | workbook.sheet(0).delete();
|
219 | ```
|
220 |
|
221 | You can get/set the active sheet:
|
222 | ```js
|
223 | // Get the active sheet
|
224 | const sheet = workbook.activeSheet();
|
225 |
|
226 | // Check if the current sheet is active
|
227 | sheet.active() // returns true or false
|
228 |
|
229 | // Activate the sheet
|
230 | sheet.active(true);
|
231 |
|
232 | // Or from the workbook
|
233 | workbook.activeSheet("Sheet2");
|
234 | ```
|
235 |
|
236 | ### Defined Names
|
237 | Excel supports creating defined names that refer to addresses, formulas, or constants. These defined names can be scoped
|
238 | to the entire workbook or just individual sheets. xlsx-populate supports looking up defined names that refer to cells or
|
239 | ranges. (Dereferencing other names will result in an error.) Defined names are particularly useful if you are populating
|
240 | data into a known template. Then you do not need to know the exact location.
|
241 |
|
242 | ```js
|
243 | // Look up workbook-scoped name and set the value to 5.
|
244 | workbook.definedName("some name").value(5);
|
245 |
|
246 | // Look of a name scoped to the first sheet and set the value to "foo".
|
247 | workbook.sheet(0).definedName("some other name").value("foo");
|
248 | ```
|
249 |
|
250 | You can also create, modify, or delete defined names:
|
251 | ```js
|
252 | // Create/modify a workbook-scope defined name
|
253 | workbook.definedName("some name", "TRUE");
|
254 |
|
255 | // Delete a sheet-scoped defined name:
|
256 | workbook.sheet(0).definedName("some name", null);
|
257 | ```
|
258 |
|
259 | ### Find and Replace
|
260 | You can search for occurrences of text in cells within the workbook or sheets and optionally replace them.
|
261 | ```js
|
262 | // Find all occurrences of the text "foo" in the workbook and replace with "bar".
|
263 | workbook.find("foo", "bar"); // Returns array of matched cells
|
264 |
|
265 | // Find the matches but don't replace.
|
266 | workbook.find("foo");
|
267 |
|
268 | // Just look in the first sheet.
|
269 | workbook.sheet(0).find("foo");
|
270 |
|
271 | // Check if a particular cell matches the value.
|
272 | workbook.sheet("Sheet1").cell("A1").find("foo"); // Returns true or false
|
273 | ```
|
274 |
|
275 | Like [String.replace](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace), the find method can also take a RegExp search pattern and replace can take a function callback:
|
276 | ```js
|
277 | // Use a RegExp to replace all lowercase letters with uppercase
|
278 | workbook.find(/[a-z]+/g, match => match.toUpperCase());
|
279 | ```
|
280 |
|
281 | ### Styles
|
282 | xlsx-populate supports a wide range of cell formatting. See the [Style Reference](#style-reference) for the various options.
|
283 |
|
284 | To get/set a cell style:
|
285 | ```js
|
286 | // Get a single style
|
287 | const bold = cell.style("bold"); // true
|
288 |
|
289 | // Get multiple styles
|
290 | const styles = cell.style(["bold", "italic"]); // { bold: true, italic: true }
|
291 |
|
292 | // Set a single style
|
293 | cell.style("bold", true);
|
294 |
|
295 | // Set multiple styles
|
296 | cell.style({ bold: true, italic: true });
|
297 | ```
|
298 |
|
299 | Similarly for ranges:
|
300 | ```js
|
301 | // Set all cells in range with a single style
|
302 | range.style("bold", true);
|
303 |
|
304 | // Set with a 2D array
|
305 | range.style("bold", [[true, false], [false, true]]);
|
306 |
|
307 | // Set with a callback function
|
308 | range.style("bold", (cell, ri, ci, range) => Math.random() > 0.5);
|
309 |
|
310 | // Set multiple styles using any combination
|
311 | range.style({
|
312 | bold: true,
|
313 | italic: [[true, false], [false, true]],
|
314 | underline: (cell, ri, ci, range) => Math.random() > 0.5
|
315 | });
|
316 | ```
|
317 |
|
318 | If you are setting styles for many cells, performance is far better if you set for an entire row or column:
|
319 | ```js
|
320 | // Set a single style
|
321 | sheet.row(1).style("bold", true);
|
322 |
|
323 | // Set multiple styles
|
324 | sheet.column("A").style({ bold: true, italic: true });
|
325 |
|
326 | // Get a single style
|
327 | const bold = sheet.column(3).style("bold");
|
328 |
|
329 | // Get multiple styles
|
330 | const styles = sheet.row(5).style(["bold", "italic"]);
|
331 | ```
|
332 | Note that the row/column style behavior mirrors Excel. Setting a style on a column will apply that style to all existing cells and any new cells that are populated. Getting the row/column style will return only the styles that have been applied to the entire row/column, not the styles of every cell in the row or column.
|
333 |
|
334 | Some styles take values that are more complex objects:
|
335 | ```js
|
336 | cell.style("fill", {
|
337 | type: "pattern",
|
338 | pattern: "darkDown",
|
339 | foreground: {
|
340 | rgb: "ff0000"
|
341 | },
|
342 | background: {
|
343 | theme: 3,
|
344 | tint: 0.4
|
345 | }
|
346 | });
|
347 | ```
|
348 |
|
349 | There are often shortcuts for the setters, but the getters will always return the full objects:
|
350 | ```js
|
351 | cell.style("fill", "0000ff");
|
352 |
|
353 | const fill = cell.style("fill");
|
354 | /*
|
355 | fill is now set to:
|
356 | {
|
357 | type: "solid",
|
358 | color: {
|
359 | rgb: "0000ff"
|
360 | }
|
361 | }
|
362 | */
|
363 | ```
|
364 |
|
365 | Number formats are one of the most common styles. They can be set using the `numberFormat` style.
|
366 | ```js
|
367 | cell.style("numberFormat", "0.00");
|
368 | ```
|
369 |
|
370 | Information on how number format codes work can be found [here](https://support.office.com/en-us/article/Number-format-codes-5026bbd6-04bc-48cd-bf33-80f18b4eae68?ui=en-US&rs=en-US&ad=US).
|
371 | You can also look up the desired format code in Excel:
|
372 | * Right-click on a cell in Excel with the number format you want.
|
373 | * Click on "Format Cells..."
|
374 | * Switch the category to "Custom" if it is not already.
|
375 | * The code in the "Type" box is the format you should copy.
|
376 |
|
377 | ### Rich Texts
|
378 | You can read/write rich texts to cells.
|
379 |
|
380 | #### Supported styles
|
381 | `bold`, `italic`, `underline`, `strikethrough`, `subscript`, `fontSize`,
|
382 | `fontFamily`, `fontGenericFamily`, `fontScheme`, `fontColor`.
|
383 | See the [Style Reference](#style-reference) for the various options.
|
384 |
|
385 | #### Usage
|
386 | You can read and modify rich texts on an existing rich text cell:
|
387 | ```js
|
388 | // assume A1 is a rich text cell
|
389 | const RichText = require('xlsx-Populate').RichText;
|
390 | const cell = workbook.sheet(0).cell('A1');
|
391 | cell.value() instanceof RichText // returns true
|
392 | const richtext = cell.value();
|
393 | // get the concatenate text
|
394 | richtext.text();
|
395 |
|
396 | // loop through each rich text fragment
|
397 | for (let i = 0; i < richtext.length; i++) {
|
398 | const fragment = richtext.get(i);
|
399 | // Get the style
|
400 | fragment.style('bold');
|
401 | // Get many styles
|
402 | fragment.style(['bold', 'italic']);
|
403 | // Set one style
|
404 | fragment.style('bold', true);
|
405 | // Set many styles
|
406 | fragment.style({ 'bold': true, 'italic': true });
|
407 | // Get the value
|
408 | fragment.value();
|
409 | // Set the value
|
410 | fragment.value('hello');
|
411 | }
|
412 |
|
413 | // remove the first rich text fragment
|
414 | richtext.remove(0);
|
415 |
|
416 | // clear this rich texts
|
417 | richtext.clear();
|
418 | ```
|
419 |
|
420 | How to set a cell to rich texts:
|
421 | ```js
|
422 | const RichText = require('xlsx-Populate').RichText;
|
423 | const cell = workbook.sheet(0).cell('A1');
|
424 | // set a cell value to rich text
|
425 | cell.value(new RichText());
|
426 |
|
427 | // add two rich text fragments
|
428 | cell.value()
|
429 | .add('hello ', { italic: true, bold: true })
|
430 | .add('world!', { fontColor: 'FF0000' });
|
431 | ````
|
432 |
|
433 | You can specify the index when adding rich text fragment.
|
434 | ```js
|
435 | // add before the first fragment
|
436 | cell.value().add('text', { bold: true }, 0);
|
437 | // add before the second fragment
|
438 | cell.value().add('text', { bold: true }, 1);
|
439 | // add after the last fragment
|
440 | cell.value().add('text', { bold: true });
|
441 | ```
|
442 | #### Notes
|
443 | We make a deep copy of the richtext instance when assign it to a cell, which
|
444 | means you can only modify the content of the richtext before calling `cell.value(richtext)`.
|
445 | Any modification to the richtext instance after calling `cell.value(richtext)` will not
|
446 | save to the cell. i.e.
|
447 | ```js
|
448 | const richtext = new RichText();
|
449 | richtext.add('hello');
|
450 | cell.value(richtext);
|
451 | cell.value().text(); // returns 'hello'
|
452 |
|
453 | richtext.add(' world')
|
454 | richtext.text(); // returns 'hello world'
|
455 | cell.value().text(); // returns 'hello'
|
456 | cell.value() === richtext; // returns false
|
457 |
|
458 | cell.value().add(' world');
|
459 | cell.value().text(); // returns 'hello world'
|
460 | ```
|
461 |
|
462 | This means you can create a rich text instance and assign it to any cells! Each cell does
|
463 | not share the same instance but creates a deep copy of the instance.
|
464 | ```js
|
465 | const sheet = workbook.sheet(0);
|
466 | const richtext = new RichText();
|
467 | richtext.add('hello');
|
468 | const range = sheet.range("A1:C3");
|
469 | range.value(richtext);
|
470 | // they do not share the same instance
|
471 | sheet.cell('A1').value() === sheet.cell('C1').value() // returns false
|
472 | ```
|
473 |
|
474 | You can get the rich text from a cell and set it to anoher cell.
|
475 | ```js
|
476 | const richtext = cell1.value();
|
477 | cell2.value(richtext);
|
478 | cell1.value() === cell2.value() // returns false
|
479 | ```
|
480 |
|
481 | Whenever you call `richtext.add(text, styles, index)`, we will detect if the given `text`
|
482 | contains line separators (`\n`, `\r`, `\r\n`), if it does, we will call
|
483 | `cell.style('wrapText', true)` for you. MS Excel needs wrapText to be true
|
484 | to have the new lines displayed, otherwise you will see the texts in one line.
|
485 | You may also need to set row height to have all lines displayed.
|
486 | ```js
|
487 | cell.value()
|
488 | // it support all line separators
|
489 | .add('123\n456\r789\r\n10', { italic: true, fontColor: '123456' })
|
490 | // remember to set height to show the whole row
|
491 | workbook.sheet(0).row(1).height(100);
|
492 | ```
|
493 |
|
494 | ### Dates
|
495 |
|
496 | Excel stores date/times as the number of days since 1/1/1900 ([sort of](https://en.wikipedia.org/wiki/Leap_year_bug)). It just applies a number formatting to make the number appear as a date. So to set a date value, you will need to also set a number format for a date if one doesn't already exist in the cell:
|
497 | ```js
|
498 | cell.value(new Date(2017, 1, 22)).style("numberFormat", "dddd, mmmm dd, yyyy");
|
499 | ```
|
500 | When fetching the value of the cell, it will be returned as a number. To convert it to a date use [XlsxPopulate.numberToDate](#XlsxPopulate.numberToDate):
|
501 | ```js
|
502 | const num = cell.value(); // 42788
|
503 | const date = XlsxPopulate.numberToDate(num); // Wed Feb 22 2017 00:00:00 GMT-0500 (Eastern Standard Time)
|
504 | ```
|
505 |
|
506 | ### Data Validation
|
507 | Data validation is also supported. To set/get/remove a cell data validation:
|
508 | ```js
|
509 | // Set the data validation
|
510 | cell.dataValidation({
|
511 | type: 'list',
|
512 | allowBlank: false,
|
513 | showInputMessage: false,
|
514 | prompt: false,
|
515 | promptTitle: 'String',
|
516 | showErrorMessage: false,
|
517 | error: 'String',
|
518 | errorTitle: 'String',
|
519 | operator: 'String',
|
520 | formula1: '$A:$A',//Required
|
521 | formula2: 'String'
|
522 | });
|
523 |
|
524 | //Here is a short version of the one above.
|
525 | cell.dataValidation('$A:$A');
|
526 |
|
527 | // Get the data validation
|
528 | const obj = cell.dataValidation(); // Returns an object
|
529 |
|
530 | // Remove the data validation
|
531 | cell.dataValidation(null); //Returns the cell
|
532 | ```
|
533 |
|
534 | Similarly for ranges:
|
535 | ```js
|
536 |
|
537 | // Set all cells in range with a single shared data validation
|
538 | range.dataValidation({
|
539 | type: 'list',
|
540 | allowBlank: false,
|
541 | showInputMessage: false,
|
542 | prompt: false,
|
543 | promptTitle: 'String',
|
544 | showErrorMessage: false,
|
545 | error: 'String',
|
546 | errorTitle: 'String',
|
547 | operator: 'String',
|
548 | formula1: 'Item1,Item2,Item3,Item4',//Required
|
549 | formula2: 'String'
|
550 | });
|
551 |
|
552 | //Here is a short version of the one above.
|
553 | range.dataValidation('Item1,Item2,Item3,Item4');
|
554 |
|
555 | // Get the data validation
|
556 | const obj = range.dataValidation(); // Returns an object
|
557 |
|
558 | // Remove the data validation
|
559 | range.dataValidation(null); //Returns the Range
|
560 | ```
|
561 | Please note, the data validation gets applied to the entire range, *not* each Cell in the range.
|
562 |
|
563 | ### Method Chaining
|
564 |
|
565 | xlsx-populate uses method-chaining similar to that found in [jQuery](https://jquery.com/) and [d3](https://d3js.org/). This lets you construct large chains of setters as desired:
|
566 | ```js
|
567 | workbook
|
568 | .sheet(0)
|
569 | .cell("A1")
|
570 | .value("foo")
|
571 | .style("bold", true)
|
572 | .relativeCell(1, 0)
|
573 | .formula("A1")
|
574 | .style("italic", true)
|
575 | .workbook()
|
576 | .sheet(1)
|
577 | .range("A1:B3")
|
578 | .value(5)
|
579 | .cell(0, 0)
|
580 | .style("underline", "double");
|
581 |
|
582 | ```
|
583 |
|
584 | ### Hyperlinks
|
585 | Hyperlinks are also supported on cells using the [Cell.hyperlink](#Cell+hyperlink) method. The method will _not_ style the content to look like a hyperlink. You must do that yourself:
|
586 | ```js
|
587 | // Set a hyperlink
|
588 | cell.value("Link Text")
|
589 | .style({ fontColor: "0563c1", underline: true })
|
590 | .hyperlink("http://example.com");
|
591 |
|
592 | // Set a hyperlink with tooltip
|
593 | cell.value("Link Text")
|
594 | .style({ fontColor: "0563c1", underline: true })
|
595 | .hyperlink({ hyperlink: "http://example.com", tooltip: "example.com" });
|
596 |
|
597 | // Get the hyperlink
|
598 | const value = cell.hyperlink(); // Returns 'http://example.com'
|
599 |
|
600 | // Set a hyperlink to email
|
601 | cell.value("Click to Email Jeff Bezos")
|
602 | .hyperlink({ email: "jeff@amazon.com", emailSubject: "I know you're a busy man Jeff, but..." });
|
603 |
|
604 | // Set a hyperlink to an internal cell using an address string.
|
605 | cell.value("Click to go to an internal cell")
|
606 | .hyperlink("Sheet2!A1");
|
607 |
|
608 | // Set a hyperlink to an internal cell using a cell object.
|
609 | cell.value("Click to go to an internal cell")
|
610 | .hyperlink(workbook.sheet(0).cell("A1"));
|
611 | ```
|
612 |
|
613 | ### Print Options
|
614 | Print options are accessed using the [Sheet.printOptions](#Sheet+printOptions) method. Defaults are all assumed to be false, so if the attribute is missing, then the method returns false. A method [Sheet.printGridLines](#Sheet+printGridLines) is provided to offer the convenience of setting both gridLines and gridLinesSet.
|
615 | ```js
|
616 | // Print row and column headings
|
617 | sheet.printOptions('headings', true);
|
618 |
|
619 | // Get the headings flag
|
620 | const headings = sheet.printOptions('headings'); // Returns true
|
621 |
|
622 | // Clear flag for center on page vertically when printing
|
623 | sheet.printOptions('verticalCentered', undefined);
|
624 |
|
625 | // Get the verticalCentered flag
|
626 | const verticalCentered = sheet.printOptions('verticalCentered'); // Returns false
|
627 |
|
628 | // Enable grid lines in print
|
629 | sheet.printGridLines(true);
|
630 |
|
631 | // Now both gridLines and gridLinesSet print options are set
|
632 | sheet.printOptions('gridLines') === sheet.printOptions('gridLinesSet') === true; // Returns true
|
633 |
|
634 | // To disable, just disable one of gridLines or gridLinesSet
|
635 | sheet.printOptions('gridLineSets', false);
|
636 |
|
637 | const isPrintGridLinesEnabled = sheet.printGridLines(); // Returns false
|
638 | ```
|
639 |
|
640 | ### Page Margins
|
641 | Excel requires that all page margins are defined or none at all. To ensure this, please choose an existing or custom preset. See [Sheet.pageMarginsPreset](#Sheet+pageMarginsPreset).
|
642 |
|
643 | ```js
|
644 | // Get the current preset
|
645 | sheet.pageMarginsPreset(); // Returns undefined
|
646 |
|
647 | // Switch to an existing preset
|
648 | sheet.pageMarginsPreset('normal');
|
649 | ```
|
650 |
|
651 | Page margins are accessed using the [Sheet.pageMargins](#Sheet+pageMargins) method. If a page margin is not set, the preset will fill in the gaps.
|
652 |
|
653 | ```js
|
654 | // Get top margin in inches, note that the current preset is currently set to normal (see above)
|
655 | sheet.pageMargins('top'); // Returns 0.75
|
656 |
|
657 | // Set top page margin in inches
|
658 | sheet.pageMargins('top', 1.1);
|
659 |
|
660 | // Get top page margin in inches.
|
661 | const topPageMarginInInches = sheet.pageMargins('top'); // Returns 1.1
|
662 | ```
|
663 |
|
664 | ### SheetView Panes
|
665 | SheetView Panes are accessed using the [Sheet.panes](#Sheet+panes) method.
|
666 | For convenience, we have [Sheet.freezePanes](#Sheet+freezePanes),
|
667 | [Sheet.splitPanes](#Sheet+splitPanes), [Sheet.resetPanes](#Sheet+resetPanes),
|
668 | and type [PaneOptions](#paneoptions--object).
|
669 | ```js
|
670 | // access Pane options
|
671 | sheet.panes(); // return PaneOptions Object
|
672 |
|
673 | // manually Set Pane options, WARNING: setting wrong options may result in excel fails to open.
|
674 | const paneOptions = { state: 'frozen', topLeftCell: 'B2', xSplit: 1, ySplit: 1, activePane: 'bottomRight' }
|
675 | sheet.panes(paneOptions); // return PaneOptions Object
|
676 |
|
677 | // freeze panes (freeze first column and first two rows)
|
678 | sheet.freezePanes(1, 2);
|
679 | // OR
|
680 | sheet.freezePanes('B3');
|
681 |
|
682 | // split panes (Horizontal Split Position: 1000 / 20 pt, Vertical Split Position: 2000 / 20 pt)
|
683 | sheet.splitPanes(1000, 2000);
|
684 |
|
685 | // reset to normal panes (no freeze panes and split panes)
|
686 | sheet.resetPanes();
|
687 | ```
|
688 |
|
689 | ### Serving from Express
|
690 | You can serve the workbook from [express](http://expressjs.com/) or other web servers with something like this:
|
691 | ```js
|
692 | router.get("/download", function (req, res, next) {
|
693 | // Open the workbook.
|
694 | XlsxPopulate.fromFileAsync("input.xlsx")
|
695 | .then(workbook => {
|
696 | // Make edits.
|
697 | workbook.sheet(0).cell("A1").value("foo");
|
698 |
|
699 | // Get the output
|
700 | return workbook.outputAsync();
|
701 | })
|
702 | .then(data => {
|
703 | // Set the output file name.
|
704 | res.attachment("output.xlsx");
|
705 |
|
706 | // Send the workbook.
|
707 | res.send(data);
|
708 | })
|
709 | .catch(next);
|
710 | });
|
711 | ```
|
712 |
|
713 | ### Browser Usage
|
714 | Usage in the browser is almost the same. A functional example can be found in [examples/browser/index.html](https://gitcdn.xyz/repo/dtjohnson/xlsx-populate/master/examples/browser/index.html). The library is exposed globally as `XlsxPopulate`. Existing workbooks can be loaded from a file:
|
715 | ```js
|
716 | // Assuming there is a file input in the page with the id 'file-input'
|
717 | var file = document.getElementById("file-input").files[0];
|
718 |
|
719 | // A File object is a special kind of blob.
|
720 | XlsxPopulate.fromDataAsync(file)
|
721 | .then(function (workbook) {
|
722 | // ...
|
723 | });
|
724 | ```
|
725 |
|
726 | You can also load from AJAX if you set the responseType to 'arraybuffer':
|
727 | ```js
|
728 | var req = new XMLHttpRequest();
|
729 | req.open("GET", "http://...", true);
|
730 | req.responseType = "arraybuffer";
|
731 | req.onreadystatechange = function () {
|
732 | if (req.readyState === 4 && req.status === 200){
|
733 | XlsxPopulate.fromDataAsync(req.response)
|
734 | .then(function (workbook) {
|
735 | // ...
|
736 | });
|
737 | }
|
738 | };
|
739 |
|
740 | req.send();
|
741 | ```
|
742 |
|
743 | To download the workbook, you can either export as a blob (default behavior) or as a base64 string. You can then insert a link into the DOM and click it:
|
744 | ```js
|
745 | workbook.outputAsync()
|
746 | .then(function (blob) {
|
747 | if (window.navigator && window.navigator.msSaveOrOpenBlob) {
|
748 | // If IE, you must uses a different method.
|
749 | window.navigator.msSaveOrOpenBlob(blob, "out.xlsx");
|
750 | } else {
|
751 | var url = window.URL.createObjectURL(blob);
|
752 | var a = document.createElement("a");
|
753 | document.body.appendChild(a);
|
754 | a.href = url;
|
755 | a.download = "out.xlsx";
|
756 | a.click();
|
757 | window.URL.revokeObjectURL(url);
|
758 | document.body.removeChild(a);
|
759 | }
|
760 | });
|
761 | ```
|
762 |
|
763 | Alternatively, you can download via a data URI, but this is not supported by IE:
|
764 | ```js
|
765 | workbook.outputAsync("base64")
|
766 | .then(function (base64) {
|
767 | location.href = "data:" + XlsxPopulate.MIME_TYPE + ";base64," + base64;
|
768 | });
|
769 | ```
|
770 |
|
771 | ### Promises
|
772 | xlsx-populate uses [promises](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) to manage async input/output. By default it uses the `Promise` defined in the browser or Node.js. In browsers that don't support promises (IE) a [polyfill is used via JSZip](https://stuk.github.io/jszip/documentation/api_jszip/external.html).
|
773 | ```js
|
774 | // Get the current promise library in use.
|
775 | // Helpful for getting a usable Promise library in IE.
|
776 | var Promise = XlsxPopulate.Promise;
|
777 | ```
|
778 |
|
779 | If you prefer, you can override the default `Promise` library used with another ES6 compliant library like [bluebird](http://bluebirdjs.com/).
|
780 | ```js
|
781 | const Promise = require("bluebird");
|
782 | const XlsxPopulate = require("xlsx-populate");
|
783 | XlsxPopulate.Promise = Promise;
|
784 | ```
|
785 |
|
786 | ### Encryption
|
787 | XLSX Agile encryption and descryption are supported so you can read and write password-protected workbooks. To read a protected workbook, pass the password in as an option:
|
788 | ```js
|
789 | XlsxPopulate.fromFileAsync("./Book1.xlsx", { password: "S3cret!" })
|
790 | .then(workbook => {
|
791 | // ...
|
792 | });
|
793 | ```
|
794 |
|
795 | Similarly, to write a password encrypted workbook:
|
796 | ```js
|
797 | workbook.toFileAsync("./out.xlsx", { password: "S3cret!" });
|
798 | ```
|
799 | The password option is supported in all output methods. N.B. Workbooks will only be encrypted if you supply a password when outputting even if they had a password when reading.
|
800 |
|
801 | Encryption support is also available in the browser, but take care! Any password you put in browser code can be read by anyone with access to your code. You should only use passwords that are supplied by the end-user. Also, the performance of encryption/decryption in the browser is far worse than with Node.js. IE, in particular, is extremely slow. xlsx-populate is bundled for browsers with and without encryption support as the encryption libraries increase the size of the bundle a lot.
|
802 |
|
803 | ## Missing Features
|
804 | There are many, many features of the XLSX format that are not yet supported. If your use case needs something that isn't supported
|
805 | please open an issue to show your support. Better still, feel free to [contribute](#contributing) a pull request!
|
806 |
|
807 | ## Submitting an Issue
|
808 | If you happen to run into a bug or an issue, please feel free to [submit an issue](https://github.com/dtjohnson/xlsx-populate/issues). I only ask that you please include sample JavaScript code that demonstrates the issue.
|
809 | If the problem lies with modifying some template, it is incredibly difficult to debug the issue without the template. So please attach the template if possible. If you have confidentiality concerns, please attach a different workbook that exhibits the issue or you can send your workbook directly to [dtjohnson](https://github.com/dtjohnson) after creating the issue.
|
810 |
|
811 | ## Contributing
|
812 |
|
813 | Pull requests are very much welcome! If you'd like to contribute, please make sure to read this section carefully first.
|
814 |
|
815 | ### How xlsx-populate Works
|
816 | An XLSX workbook is essentially a zip of a bunch of XML files. xlsx-populate uses [JSZip](https://stuk.github.io/jszip/)
|
817 | to unzip the workbook and [sax-js](https://github.com/isaacs/sax-js) to parse the XML documents into corresponding objects.
|
818 | As you call methods, xlsx-populate manipulates the content of those objects. When you generate the output, xlsx-populate
|
819 | uses [xmlbuilder-js](https://github.com/oozcitak/xmlbuilder-js) to convert the objects back to XML and then uses JSZip to
|
820 | rezip them back into a workbook.
|
821 |
|
822 | The way in which xlsx-populate manipulates objects that are essentially the XML data is very different from the usual way
|
823 | parser/generator libraries work. Most other libraries will deserialize the XML into a rich object model. That model is then
|
824 | manipulated and serialized back into XML upon generation. The challenge with this approach is that the Office Open XML spec is [HUGE](http://www.ecma-international.org/publications/standards/Ecma-376.htm).
|
825 | It is extremely difficult for libraries to be able to support the entire specification. So these other libraries will deserialize
|
826 | only the portion of the spec they support and any other content/styles in the workbook they don't support are lost. Since
|
827 | xlsx-populate just manipulates the XML data, it is able to preserve styles and other content while still only supporting
|
828 | a fraction of the spec.
|
829 |
|
830 | ### Setting up your Environment
|
831 | You'll need to make sure [Node.js](https://nodejs.org/en/) v4+ is installed (as xlsx-populate uses ES6 syntax). You'll also
|
832 | need to install [gulp](https://github.com/gulpjs/gulp):
|
833 | ```bash
|
834 | npm install -g gulp
|
835 | ```
|
836 |
|
837 | Make sure you have [git](https://git-scm.com/) installed. Then follow [this guide](https://git-scm.com/book/en/v2/GitHub-Contributing-to-a-Project) to see how to check out code, branch, and
|
838 | then submit your code as a pull request. When you check out the code, you'll first need to install the npm dependencies.
|
839 | From the project root, run:
|
840 | ```bash
|
841 | npm install
|
842 | ```
|
843 |
|
844 | The default gulp task is set up to watch the source files for updates and retest while you edit. From the project root just run:
|
845 | ```bash
|
846 | gulp
|
847 | ```
|
848 |
|
849 | You should see the test output in your console window. As you edit files the tests will run again and show you if you've
|
850 | broken anything. (Note that if you've added new files you'll need to restart gulp for the new files to be watched.)
|
851 |
|
852 | Now write your code and make sure to add [Jasmine](https://jasmine.github.io/) unit tests. When you are finished, you need
|
853 | to build the code for the browser. Do that by running the gulp build command:
|
854 | ```bash
|
855 | gulp build
|
856 | ```
|
857 |
|
858 | Verify all is working, check in your code, and submit a pull request.
|
859 |
|
860 | ### Pull Request Checklist
|
861 | To make sure your code is consistent and high quality, please make sure to follow this checklist before submitting a pull request:
|
862 | * Your code must follow the getter/setter pattern using a single function for both. Check `arguments.length` or use `ArgHandler` to distinguish.
|
863 | * You must use valid [JSDoc](http://usejsdoc.org/) comments on *all* methods and classes. Use `@private` for private methods and `@ignore` for any public methods that are internal to xlsx-populate and should not be included in the public API docs.
|
864 | * You must adhere to the configured [ESLint](http://eslint.org/) linting rules. You can configure your IDE to display rule violations live or you can run `gulp lint` to see them.
|
865 | * Use [ES6](http://es6-features.org/#Constants) syntax. (This should be enforced by ESLint.)
|
866 | * Make sure to have full [Jasmine](https://jasmine.github.io/) unit test coverage for your code.
|
867 | * Make sure all tests pass successfully.
|
868 | * Whenever possible, do not modify/break existing API behavior. This module adheres to the [semantic versioning standard](https://docs.npmjs.com/getting-started/semantic-versioning). So any breaking changes will require a major release.
|
869 | * If your feature needs more documentation than just the JSDoc output, please add to the docs/template.md README file.
|
870 |
|
871 |
|
872 | ### Gulp Tasks
|
873 |
|
874 | xlsx-populate uses [gulp](https://github.com/gulpjs/gulp) as a build tool. There are a number of tasks:
|
875 |
|
876 | * __browser__ - Transpile and build client-side JavaScript project bundle using [browserify](http://browserify.org/) and [babelify](https://github.com/babel/babelify).
|
877 | * __lint__ - Check project source code style using [ESLint](http://eslint.org/).
|
878 | * __unit__ - Run [Jasmine](https://jasmine.github.io/) unit tests.
|
879 | * __unit-browser__ - Run the unit tests in real browsers using [Karma](https://karma-runner.github.io/1.0/index.html).
|
880 | * __e2e-parse__ - End-to-end tests of parsing data out of sample workbooks that were created in Microsoft Excel.
|
881 | * __e2e-generate__ - End-to-end tests of generating workbooks using xlsx-populate. To verify the workbooks were truly generated correctly they need to be opened in Microsoft Excel and verified. This task automates this verification using the .NET Excel Interop library with [Edge.js](https://github.com/tjanczuk/edge) acting as a bridge between Node.js and C#. Note that these tests will _only_ run on Windows with Microsoft Excel and the [Primary Interop Assemblies installed](https://msdn.microsoft.com/en-us/library/kh3965hw.aspx).
|
882 | * __e2e-browser__ - End-to-end tests of usage of the browserify bundle in real browsers using Karma.
|
883 | * __blank__ - Convert a blank XLSX template into a JS buffer module to support [fromBlankAsync](#XlsxPopulate.fromBlankAsync).
|
884 | * __docs__ - Build this README doc by combining docs/template.md, API docs generated with [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown), and a table of contents generated with [markdown-toc](https://github.com/jonschlinkert/markdown-toc).
|
885 | * __watch__ - Watch files for changes and then run associated gulp task. (Used by the default task.)
|
886 | * __build__ - Run all gulp tasks, including linting and tests, and build the docs and browser bundle.
|
887 | * __default__ - Run blank, unit, and docs tasks and watch the source files for those tasks for changes.
|
888 |
|
889 | ## Style Reference
|
890 |
|
891 | ### Styles
|
892 | |Style Name|Type|Description|
|
893 | | ------------- | ------------- | ----- |
|
894 | |bold|`boolean`|`true` for bold, `false` for not bold|
|
895 | |italic|`boolean`|`true` for italic, `false` for not italic|
|
896 | |underline|<code>boolean|string</code>|`true` for single underline, `false` for no underline, `'double'` for double-underline|
|
897 | |strikethrough|`boolean`|`true` for strikethrough `false` for not strikethrough|
|
898 | |subscript|`boolean`|`true` for subscript, `false` for not subscript (cannot be combined with superscript)|
|
899 | |superscript|`boolean`|`true` for superscript, `false` for not superscript (cannot be combined with subscript)|
|
900 | |fontSize|`number`|Font size in points. Must be greater than 0.|
|
901 | |fontFamily|`string`|Name of font family.|
|
902 | |fontGenericFamily|`number`|1: Serif, 2: Sans Serif, 3: Monospace, |
|
903 | |fontScheme|`string`|`'minor'`\|`'major'`\|`'none'` |
|
904 | |fontColor|<code>Color|string|number</code>|Color of the font. If string, will set an RGB color. If number, will set a theme color.|
|
905 | |horizontalAlignment|`string`|Horizontal alignment. Allowed values: `'left'`, `'center'`, `'right'`, `'fill'`, `'justify'`, `'centerContinuous'`, `'distributed'`|
|
906 | |justifyLastLine|`boolean`|a.k.a Justified Distributed. Only applies when horizontalAlignment === `'distributed'`. A boolean value indicating if the cells justified or distributed alignment should be used on the last line of text. (This is typical for East Asian alignments but not typical in other contexts.)|
|
907 | |indent|`number`|Number of indents. Must be greater than or equal to 0.|
|
908 | |verticalAlignment|`string`|Vertical alignment. Allowed values: `'top'`, `'center'`, `'bottom'`, `'justify'`, `'distributed'`|
|
909 | |wrapText|`boolean`|`true` to wrap the text in the cell, `false` to not wrap.|
|
910 | |shrinkToFit|`boolean`|`true` to shrink the text in the cell to fit, `false` to not shrink.|
|
911 | |textDirection|`string`|Direction of the text. Allowed values: `'left-to-right'`, `'right-to-left'`|
|
912 | |textRotation|`number`|Counter-clockwise angle of rotation in degrees. Must be [-90, 90] where negative numbers indicate clockwise rotation.|
|
913 | |angleTextCounterclockwise|`boolean`|Shortcut for textRotation of 45 degrees.|
|
914 | |angleTextClockwise|`boolean`|Shortcut for textRotation of -45 degrees.|
|
915 | |rotateTextUp|`boolean`|Shortcut for textRotation of 90 degrees.|
|
916 | |rotateTextDown|`boolean`|Shortcut for textRotation of -90 degrees.|
|
917 | |verticalText|`boolean`|Special rotation that shows text vertical but individual letters are oriented normally. `true` to rotate, `false` to not rotate.|
|
918 | |fill|<code>SolidFill|PatternFill|GradientFill|Color|string|number</code>|The cell fill. If Color, will set a solid fill with the color. If string, will set a solid RGB fill. If number, will set a solid theme color fill.|
|
919 | |border|<code>Borders|Border|string|boolean</code>|The border settings. If string, will set outside borders to given border style. If true, will set outside border style to `'thin'`.|
|
920 | |borderColor|<code>Color|string|number</code>|Color of the borders. If string, will set an RGB color. If number, will set a theme color.|
|
921 | |borderStyle|`string`|Style of the outside borders. Allowed values: `'hair'`, `'dotted'`, `'dashDotDot'`, `'dashed'`, `'mediumDashDotDot'`, `'thin'`, `'slantDashDot'`, `'mediumDashDot'`, `'mediumDashed'`, `'medium'`, `'thick'`, `'double'`|
|
922 | |leftBorder, rightBorder, topBorder, bottomBorder, diagonalBorder|<code>Border|string|boolean</code>|The border settings for the given side. If string, will set border to the given border style. If true, will set border style to `'thin'`.|
|
923 | |leftBorderColor, rightBorderColor, topBorderColor, bottomBorderColor, diagonalBorderColor|<code>Color|string|number</code>|Color of the given border. If string, will set an RGB color. If number, will set a theme color.|
|
924 | |leftBorderStyle, rightBorderStyle, topBorderStyle, bottomBorderStyle, diagonalBorderStyle|`string`|Style of the given side.|
|
925 | |diagonalBorderDirection|`string`|Direction of the diagonal border(s) from left to right. Allowed values: `'up'`, `'down'`, `'both'`|
|
926 | |numberFormat|`string`|Number format code. See docs [here](https://support.office.com/en-us/article/Number-format-codes-5026bbd6-04bc-48cd-bf33-80f18b4eae68?ui=en-US&rs=en-US&ad=US).|
|
927 |
|
928 | ### Color
|
929 | An object representing a color.
|
930 |
|
931 | |Property|Type|Description|
|
932 | | ------------- | ------------- | ----- |
|
933 | |[rgb]|`string`|RGB color code (e.g. `'ff0000'`). Either rgb or theme is required.|
|
934 | |[theme]|`number`|Index of a theme color. Either rgb or theme is required.|
|
935 | |[tint]|`number`|Optional tint value of the color from -1 to 1. Particularly useful for theme colors. 0.0 means no tint, -1.0 means 100% darken, and 1.0 means 100% lighten.|
|
936 |
|
937 | ### Borders
|
938 | An object representing all of the borders.
|
939 |
|
940 | |Property|Type|Description|
|
941 | | ------------- | ------------- | ----- |
|
942 | |[left]|<code>Border|string|boolean</code>|The border settings for the left side. If string, will set border to the given border style. If true, will set border style to `'thin'`.|
|
943 | |[right]|<code>Border|string|boolean</code>|The border settings for the right side. If string, will set border to the given border style. If true, will set border style to `'thin'`.|
|
944 | |[top]|<code>Border|string|boolean</code>|The border settings for the top side. If string, will set border to the given border style. If true, will set border style to `'thin'`.|
|
945 | |[bottom]|<code>Border|string|boolean</code>|The border settings for the bottom side. If string, will set border to the given border style. If true, will set border style to `'thin'`.|
|
946 | |[diagonal]|<code>Border|string|boolean</code>|The border settings for the diagonal side. If string, will set border to the given border style. If true, will set border style to `'thin'`.|
|
947 |
|
948 | ### Border
|
949 | An object representing an individual border.
|
950 |
|
951 | |Property|Type|Description|
|
952 | | ------------- | ------------- | ----- |
|
953 | |style|`string`|Style of the given border.|
|
954 | |color|<code>Color|string|number</code>|Color of the given border. If string, will set an RGB color. If number, will set a theme color.|
|
955 | |[direction]|`string`|For diagonal border, the direction of the border(s) from left to right. Allowed values: `'up'`, `'down'`, `'both'`|
|
956 |
|
957 | ### SolidFill
|
958 | An object representing a solid fill.
|
959 |
|
960 | |Property|Type|Description|
|
961 | | ------------- | ------------- | ----- |
|
962 | |type|`'solid'`||
|
963 | |color|<code>Color|string|number</code>|Color of the fill. If string, will set an RGB color. If number, will set a theme color.|
|
964 |
|
965 | ### PatternFill
|
966 | An object representing a pattern fill.
|
967 |
|
968 | |Property|Type|Description|
|
969 | | ------------- | ------------- | ----- |
|
970 | |type|`'pattern'`||
|
971 | |pattern|`string`|Name of the pattern. Allowed values: `'gray125'`, `'darkGray'`, `'mediumGray'`, `'lightGray'`, `'gray0625'`, `'darkHorizontal'`, `'darkVertical'`, `'darkDown'`, `'darkUp'`, `'darkGrid'`, `'darkTrellis'`, `'lightHorizontal'`, `'lightVertical'`, `'lightDown'`, `'lightUp'`, `'lightGrid'`, `'lightTrellis'`.|
|
972 | |foreground|<code>Color|string|number</code>|Color of the foreground. If string, will set an RGB color. If number, will set a theme color.|
|
973 | |background|<code>Color|string|number</code>|Color of the background. If string, will set an RGB color. If number, will set a theme color.|
|
974 |
|
975 | ### GradientFill
|
976 | An object representing a gradient fill.
|
977 |
|
978 | |Property|Type|Description|
|
979 | | ------------- | ------------- | ----- |
|
980 | |type|`'gradient'`||
|
981 | |[gradientType]|`string`|Type of gradient. Allowed values: `'linear'` (default), `'path'`. With a path gradient, a path is drawn between the top, left, right, and bottom values and a graident is draw from that path to the outside of the cell.|
|
982 | |stops|`Array.<{}>`||
|
983 | |stops[].position|`number`|The position of the stop from 0 to 1.|
|
984 | |stops[].color|<code>Color|string|number</code>|Color of the stop. If string, will set an RGB color. If number, will set a theme color.|
|
985 | |[angle]|`number`|If linear gradient, the angle of clockwise rotation of the gradient.|
|
986 | |[left]|`number`|If path gradient, the left position of the path as a percentage from 0 to 1.|
|
987 | |[right]|`number`|If path gradient, the right position of the path as a percentage from 0 to 1.|
|
988 | |[top]|`number`|If path gradient, the top position of the path as a percentage from 0 to 1.|
|
989 | |[bottom]|`number`|If path gradient, the bottom position of the path as a percentage from 0 to 1.|
|
990 |
|
991 | ## API Reference
|
992 | ### Classes
|
993 |
|
994 | <dl>
|
995 | <dt><a href="#Cell">Cell</a></dt>
|
996 | <dd><p>A cell</p>
|
997 | </dd>
|
998 | <dt><a href="#Column">Column</a></dt>
|
999 | <dd><p>A column.</p>
|
1000 | </dd>
|
1001 | <dt><a href="#FormulaError">FormulaError</a></dt>
|
1002 | <dd><p>A formula error (e.g. #DIV/0!).</p>
|
1003 | </dd>
|
1004 | <dt><a href="#PageBreaks">PageBreaks</a></dt>
|
1005 | <dd><p>PageBreaks</p>
|
1006 | </dd>
|
1007 | <dt><a href="#Range">Range</a></dt>
|
1008 | <dd><p>A range of cells.</p>
|
1009 | </dd>
|
1010 | <dt><a href="#RichText">RichText</a></dt>
|
1011 | <dd><p>A RichText class that contains many <a href="#RichTextFragment">RichTextFragment</a>.</p>
|
1012 | </dd>
|
1013 | <dt><a href="#RichTextFragment">RichTextFragment</a></dt>
|
1014 | <dd><p>A Rich text fragment.</p>
|
1015 | </dd>
|
1016 | <dt><a href="#Row">Row</a></dt>
|
1017 | <dd><p>A row.</p>
|
1018 | </dd>
|
1019 | <dt><a href="#Sheet">Sheet</a></dt>
|
1020 | <dd><p>A worksheet.</p>
|
1021 | </dd>
|
1022 | <dt><a href="#Workbook">Workbook</a></dt>
|
1023 | <dd><p>A workbook.</p>
|
1024 | </dd>
|
1025 | </dl>
|
1026 |
|
1027 | ### Objects
|
1028 |
|
1029 | <dl>
|
1030 | <dt><a href="#XlsxPopulate">XlsxPopulate</a> : <code>object</code></dt>
|
1031 | <dd></dd>
|
1032 | </dl>
|
1033 |
|
1034 | ### Constants
|
1035 |
|
1036 | <dl>
|
1037 | <dt><a href="#_">_</a></dt>
|
1038 | <dd><p>OOXML uses the CFB file format with Agile Encryption. The details of the encryption are here:
|
1039 | <a href="https://msdn.microsoft.com/en-us/library/dd950165(v=office.12).aspx">https://msdn.microsoft.com/en-us/library/dd950165(v=office.12).aspx</a></p>
|
1040 | <p>Helpful guidance also take from this Github project:
|
1041 | <a href="https://github.com/nolze/ms-offcrypto-tool">https://github.com/nolze/ms-offcrypto-tool</a></p>
|
1042 | </dd>
|
1043 | </dl>
|
1044 |
|
1045 | ### Typedefs
|
1046 |
|
1047 | <dl>
|
1048 | <dt><a href="#PaneOptions">PaneOptions</a> : <code>Object</code></dt>
|
1049 | <dd><p><a href="https://docs.microsoft.com/en-us/dotnet/api/documentformat.openxml.spreadsheet.pane?view=openxml-2.8.1">https://docs.microsoft.com/en-us/dotnet/api/documentformat.openxml.spreadsheet.pane?view=openxml-2.8.1</a></p>
|
1050 | </dd>
|
1051 | </dl>
|
1052 |
|
1053 | <a name="Cell"></a>
|
1054 |
|
1055 | ### Cell
|
1056 | A cell
|
1057 |
|
1058 | **Kind**: global class
|
1059 |
|
1060 | * [Cell](#Cell)
|
1061 | * _instance_
|
1062 | * [.active()](#Cell+active) ⇒ <code>boolean</code>
|
1063 | * [.active(active)](#Cell+active) ⇒ [<code>Cell</code>](#Cell)
|
1064 | * [.address([opts])](#Cell+address) ⇒ <code>string</code>
|
1065 | * [.column()](#Cell+column) ⇒ [<code>Column</code>](#Column)
|
1066 | * [.clear()](#Cell+clear) ⇒ [<code>Cell</code>](#Cell)
|
1067 | * [.columnName()](#Cell+columnName) ⇒ <code>string</code>
|
1068 | * [.columnNumber()](#Cell+columnNumber) ⇒ <code>number</code>
|
1069 | * [.find(pattern, [replacement])](#Cell+find) ⇒ <code>boolean</code>
|
1070 | * [.formula()](#Cell+formula) ⇒ <code>string</code>
|
1071 | * [.formula(formula)](#Cell+formula) ⇒ [<code>Cell</code>](#Cell)
|
1072 | * [.hyperlink()](#Cell+hyperlink) ⇒ <code>string</code> \| <code>undefined</code>
|
1073 | * [.hyperlink(hyperlink)](#Cell+hyperlink) ⇒ [<code>Cell</code>](#Cell)
|
1074 | * [.hyperlink(opts)](#Cell+hyperlink) ⇒ [<code>Cell</code>](#Cell)
|
1075 | * [.dataValidation()](#Cell+dataValidation) ⇒ <code>object</code> \| <code>undefined</code>
|
1076 | * [.dataValidation(dataValidation)](#Cell+dataValidation) ⇒ [<code>Cell</code>](#Cell)
|
1077 | * [.tap(callback)](#Cell+tap) ⇒ [<code>Cell</code>](#Cell)
|
1078 | * [.thru(callback)](#Cell+thru) ⇒ <code>\*</code>
|
1079 | * [.rangeTo(cell)](#Cell+rangeTo) ⇒ [<code>Range</code>](#Range)
|
1080 | * [.relativeCell(rowOffset, columnOffset)](#Cell+relativeCell) ⇒ [<code>Cell</code>](#Cell)
|
1081 | * [.row()](#Cell+row) ⇒ [<code>Row</code>](#Row)
|
1082 | * [.rowNumber()](#Cell+rowNumber) ⇒ <code>number</code>
|
1083 | * [.sheet()](#Cell+sheet) ⇒ [<code>Sheet</code>](#Sheet)
|
1084 | * [.style(name)](#Cell+style) ⇒ <code>\*</code>
|
1085 | * [.style(names)](#Cell+style) ⇒ <code>object.<string, \*></code>
|
1086 | * [.style(name, value)](#Cell+style) ⇒ [<code>Cell</code>](#Cell)
|
1087 | * [.style(name)](#Cell+style) ⇒ [<code>Range</code>](#Range)
|
1088 | * [.style(styles)](#Cell+style) ⇒ [<code>Cell</code>](#Cell)
|
1089 | * [.style(style)](#Cell+style) ⇒ [<code>Cell</code>](#Cell)
|
1090 | * [.value()](#Cell+value) ⇒ <code>string</code> \| <code>boolean</code> \| <code>number</code> \| <code>Date</code> \| [<code>RichText</code>](#RichText) \| <code>undefined</code>
|
1091 | * [.value(value)](#Cell+value) ⇒ [<code>Cell</code>](#Cell)
|
1092 | * [.value()](#Cell+value) ⇒ [<code>Range</code>](#Range)
|
1093 | * [.workbook()](#Cell+workbook) ⇒ [<code>Workbook</code>](#Workbook)
|
1094 | * [.addHorizontalPageBreak()](#Cell+addHorizontalPageBreak) ⇒ [<code>Cell</code>](#Cell)
|
1095 | * _inner_
|
1096 | * [~tapCallback](#Cell..tapCallback) ⇒ <code>undefined</code>
|
1097 | * [~thruCallback](#Cell..thruCallback) ⇒ <code>\*</code>
|
1098 |
|
1099 | <a name="Cell+active"></a>
|
1100 |
|
1101 | #### cell.active() ⇒ <code>boolean</code>
|
1102 | Gets a value indicating whether the cell is the active cell in the sheet.
|
1103 |
|
1104 | **Kind**: instance method of [<code>Cell</code>](#Cell)
|
1105 | **Returns**: <code>boolean</code> - True if active, false otherwise.
|
1106 | <a name="Cell+active"></a>
|
1107 |
|
1108 | #### cell.active(active) ⇒ [<code>Cell</code>](#Cell)
|
1109 | Make the cell the active cell in the sheet.
|
1110 |
|
1111 | **Kind**: instance method of [<code>Cell</code>](#Cell)
|
1112 | **Returns**: [<code>Cell</code>](#Cell) - The cell.
|
1113 |
|
1114 | | Param | Type | Description |
|
1115 | | --- | --- | --- |
|
1116 | | active | <code>boolean</code> | Must be set to `true`. Deactivating directly is not supported. To deactivate, you should activate a different cell instead. |
|
1117 |
|
1118 | <a name="Cell+address"></a>
|
1119 |
|
1120 | #### cell.address([opts]) ⇒ <code>string</code>
|
1121 | Get the address of the column.
|
1122 |
|
1123 | **Kind**: instance method of [<code>Cell</code>](#Cell)
|
1124 | **Returns**: <code>string</code> - The address
|
1125 |
|
1126 | | Param | Type | Description |
|
1127 | | --- | --- | --- |
|
1128 | | [opts] | <code>Object</code> | Options |
|
1129 | | [opts.includeSheetName] | <code>boolean</code> | Include the sheet name in the address. |
|
1130 | | [opts.rowAnchored] | <code>boolean</code> | Anchor the row. |
|
1131 | | [opts.columnAnchored] | <code>boolean</code> | Anchor the column. |
|
1132 | | [opts.anchored] | <code>boolean</code> | Anchor both the row and the column. |
|
1133 |
|
1134 | <a name="Cell+column"></a>
|
1135 |
|
1136 | #### cell.column() ⇒ [<code>Column</code>](#Column)
|
1137 | Gets the parent column of the cell.
|
1138 |
|
1139 | **Kind**: instance method of [<code>Cell</code>](#Cell)
|
1140 | **Returns**: [<code>Column</code>](#Column) - The parent column.
|
1141 | <a name="Cell+clear"></a>
|
1142 |
|
1143 | #### cell.clear() ⇒ [<code>Cell</code>](#Cell)
|
1144 | Clears the contents from the cell.
|
1145 |
|
1146 | **Kind**: instance method of [<code>Cell</code>](#Cell)
|
1147 | **Returns**: [<code>Cell</code>](#Cell) - The cell.
|
1148 | <a name="Cell+columnName"></a>
|
1149 |
|
1150 | #### cell.columnName() ⇒ <code>string</code>
|
1151 | Gets the column name of the cell.
|
1152 |
|
1153 | **Kind**: instance method of [<code>Cell</code>](#Cell)
|
1154 | **Returns**: <code>string</code> - The column name.
|
1155 | <a name="Cell+columnNumber"></a>
|
1156 |
|
1157 | #### cell.columnNumber() ⇒ <code>number</code>
|
1158 | Gets the column number of the cell (1-based).
|
1159 |
|
1160 | **Kind**: instance method of [<code>Cell</code>](#Cell)
|
1161 | **Returns**: <code>number</code> - The column number.
|
1162 | <a name="Cell+find"></a>
|
1163 |
|
1164 | #### cell.find(pattern, [replacement]) ⇒ <code>boolean</code>
|
1165 | Find the given pattern in the cell and optionally replace it.
|
1166 |
|
1167 | **Kind**: instance method of [<code>Cell</code>](#Cell)
|
1168 | **Returns**: <code>boolean</code> - A flag indicating if the pattern was found.
|
1169 |
|
1170 | | Param | Type | Description |
|
1171 | | --- | --- | --- |
|
1172 | | pattern | <code>string</code> \| <code>RegExp</code> | The pattern to look for. Providing a string will result in a case-insensitive substring search. Use a RegExp for more sophisticated searches. |
|
1173 | | [replacement] | <code>string</code> \| <code>function</code> | The text to replace or a String.replace callback function. If pattern is a string, all occurrences of the pattern in the cell will be replaced. |
|
1174 |
|
1175 | <a name="Cell+formula"></a>
|
1176 |
|
1177 | #### cell.formula() ⇒ <code>string</code>
|
1178 | Gets the formula in the cell. Note that if a formula was set as part of a range, the getter will return 'SHARED'. This is a limitation that may be addressed in a future release.
|
1179 |
|
1180 | **Kind**: instance method of [<code>Cell</code>](#Cell)
|
1181 | **Returns**: <code>string</code> - The formula in the cell.
|
1182 | <a name="Cell+formula"></a>
|
1183 |
|
1184 | #### cell.formula(formula) ⇒ [<code>Cell</code>](#Cell)
|
1185 | Sets the formula in the cell.
|
1186 |
|
1187 | **Kind**: instance method of [<code>Cell</code>](#Cell)
|
1188 | **Returns**: [<code>Cell</code>](#Cell) - The cell.
|
1189 |
|
1190 | | Param | Type | Description |
|
1191 | | --- | --- | --- |
|
1192 | | formula | <code>string</code> | The formula to set. |
|
1193 |
|
1194 | <a name="Cell+hyperlink"></a>
|
1195 |
|
1196 | #### cell.hyperlink() ⇒ <code>string</code> \| <code>undefined</code>
|
1197 | Gets the hyperlink attached to the cell.
|
1198 |
|
1199 | **Kind**: instance method of [<code>Cell</code>](#Cell)
|
1200 | **Returns**: <code>string</code> \| <code>undefined</code> - The hyperlink or undefined if not set.
|
1201 | <a name="Cell+hyperlink"></a>
|
1202 |
|
1203 | #### cell.hyperlink(hyperlink) ⇒ [<code>Cell</code>](#Cell)
|
1204 | Set or clear the hyperlink on the cell.
|
1205 |
|
1206 | **Kind**: instance method of [<code>Cell</code>](#Cell)
|
1207 | **Returns**: [<code>Cell</code>](#Cell) - The cell.
|
1208 |
|
1209 | | Param | Type | Description |
|
1210 | | --- | --- | --- |
|
1211 | | hyperlink | <code>string</code> \| [<code>Cell</code>](#Cell) \| <code>undefined</code> | The hyperlink to set or undefined to clear. |
|
1212 |
|
1213 | <a name="Cell+hyperlink"></a>
|
1214 |
|
1215 | #### cell.hyperlink(opts) ⇒ [<code>Cell</code>](#Cell)
|
1216 | Set the hyperlink options on the cell.
|
1217 |
|
1218 | **Kind**: instance method of [<code>Cell</code>](#Cell)
|
1219 | **Returns**: [<code>Cell</code>](#Cell) - The cell.
|
1220 |
|
1221 | | Param | Type | Description |
|
1222 | | --- | --- | --- |
|
1223 | | opts | <code>Object</code> \| [<code>Cell</code>](#Cell) | Options or Cell. If opts is a Cell then an internal hyperlink is added. |
|
1224 | | [opts.hyperlink] | <code>string</code> \| [<code>Cell</code>](#Cell) | The hyperlink to set, can be a Cell or an internal/external string. |
|
1225 | | [opts.tooltip] | <code>string</code> | Additional text to help the user understand more about the hyperlink. |
|
1226 | | [opts.email] | <code>string</code> | Email address, ignored if opts.hyperlink is set. |
|
1227 | | [opts.emailSubject] | <code>string</code> | Email subject, ignored if opts.hyperlink is set. |
|
1228 |
|
1229 | <a name="Cell+dataValidation"></a>
|
1230 |
|
1231 | #### cell.dataValidation() ⇒ <code>object</code> \| <code>undefined</code>
|
1232 | Gets the data validation object attached to the cell.
|
1233 |
|
1234 | **Kind**: instance method of [<code>Cell</code>](#Cell)
|
1235 | **Returns**: <code>object</code> \| <code>undefined</code> - The data validation or undefined if not set.
|
1236 | <a name="Cell+dataValidation"></a>
|
1237 |
|
1238 | #### cell.dataValidation(dataValidation) ⇒ [<code>Cell</code>](#Cell)
|
1239 | Set or clear the data validation object of the cell.
|
1240 |
|
1241 | **Kind**: instance method of [<code>Cell</code>](#Cell)
|
1242 | **Returns**: [<code>Cell</code>](#Cell) - The cell.
|
1243 |
|
1244 | | Param | Type | Description |
|
1245 | | --- | --- | --- |
|
1246 | | dataValidation | <code>object</code> \| <code>undefined</code> | Object or null to clear. |
|
1247 |
|
1248 | <a name="Cell+tap"></a>
|
1249 |
|
1250 | #### cell.tap(callback) ⇒ [<code>Cell</code>](#Cell)
|
1251 | Invoke a callback on the cell and return the cell. Useful for method chaining.
|
1252 |
|
1253 | **Kind**: instance method of [<code>Cell</code>](#Cell)
|
1254 | **Returns**: [<code>Cell</code>](#Cell) - The cell.
|
1255 |
|
1256 | | Param | Type | Description |
|
1257 | | --- | --- | --- |
|
1258 | | callback | [<code>tapCallback</code>](#Cell..tapCallback) | The callback function. |
|
1259 |
|
1260 | <a name="Cell+thru"></a>
|
1261 |
|
1262 | #### cell.thru(callback) ⇒ <code>\*</code>
|
1263 | Invoke a callback on the cell and return the value provided by the callback. Useful for method chaining.
|
1264 |
|
1265 | **Kind**: instance method of [<code>Cell</code>](#Cell)
|
1266 | **Returns**: <code>\*</code> - The return value of the callback.
|
1267 |
|
1268 | | Param | Type | Description |
|
1269 | | --- | --- | --- |
|
1270 | | callback | [<code>thruCallback</code>](#Cell..thruCallback) | The callback function. |
|
1271 |
|
1272 | <a name="Cell+rangeTo"></a>
|
1273 |
|
1274 | #### cell.rangeTo(cell) ⇒ [<code>Range</code>](#Range)
|
1275 | Create a range from this cell and another.
|
1276 |
|
1277 | **Kind**: instance method of [<code>Cell</code>](#Cell)
|
1278 | **Returns**: [<code>Range</code>](#Range) - The range.
|
1279 |
|
1280 | | Param | Type | Description |
|
1281 | | --- | --- | --- |
|
1282 | | cell | [<code>Cell</code>](#Cell) \| <code>string</code> | The other cell or cell address to range to. |
|
1283 |
|
1284 | <a name="Cell+relativeCell"></a>
|
1285 |
|
1286 | #### cell.relativeCell(rowOffset, columnOffset) ⇒ [<code>Cell</code>](#Cell)
|
1287 | Returns a cell with a relative position given the offsets provided.
|
1288 |
|
1289 | **Kind**: instance method of [<code>Cell</code>](#Cell)
|
1290 | **Returns**: [<code>Cell</code>](#Cell) - The relative cell.
|
1291 |
|
1292 | | Param | Type | Description |
|
1293 | | --- | --- | --- |
|
1294 | | rowOffset | <code>number</code> | The row offset (0 for the current row). |
|
1295 | | columnOffset | <code>number</code> | The column offset (0 for the current column). |
|
1296 |
|
1297 | <a name="Cell+row"></a>
|
1298 |
|
1299 | #### cell.row() ⇒ [<code>Row</code>](#Row)
|
1300 | Gets the parent row of the cell.
|
1301 |
|
1302 | **Kind**: instance method of [<code>Cell</code>](#Cell)
|
1303 | **Returns**: [<code>Row</code>](#Row) - The parent row.
|
1304 | <a name="Cell+rowNumber"></a>
|
1305 |
|
1306 | #### cell.rowNumber() ⇒ <code>number</code>
|
1307 | Gets the row number of the cell (1-based).
|
1308 |
|
1309 | **Kind**: instance method of [<code>Cell</code>](#Cell)
|
1310 | **Returns**: <code>number</code> - The row number.
|
1311 | <a name="Cell+sheet"></a>
|
1312 |
|
1313 | #### cell.sheet() ⇒ [<code>Sheet</code>](#Sheet)
|
1314 | Gets the parent sheet.
|
1315 |
|
1316 | **Kind**: instance method of [<code>Cell</code>](#Cell)
|
1317 | **Returns**: [<code>Sheet</code>](#Sheet) - The parent sheet.
|
1318 | <a name="Cell+style"></a>
|
1319 |
|
1320 | #### cell.style(name) ⇒ <code>\*</code>
|
1321 | Gets an individual style.
|
1322 |
|
1323 | **Kind**: instance method of [<code>Cell</code>](#Cell)
|
1324 | **Returns**: <code>\*</code> - The style.
|
1325 |
|
1326 | | Param | Type | Description |
|
1327 | | --- | --- | --- |
|
1328 | | name | <code>string</code> | The name of the style. |
|
1329 |
|
1330 | <a name="Cell+style"></a>
|
1331 |
|
1332 | #### cell.style(names) ⇒ <code>object.<string, \*></code>
|
1333 | Gets multiple styles.
|
1334 |
|
1335 | **Kind**: instance method of [<code>Cell</code>](#Cell)
|
1336 | **Returns**: <code>object.<string, \*></code> - Object whose keys are the style names and values are the styles.
|
1337 |
|
1338 | | Param | Type | Description |
|
1339 | | --- | --- | --- |
|
1340 | | names | <code>Array.<string></code> | The names of the style. |
|
1341 |
|
1342 | <a name="Cell+style"></a>
|
1343 |
|
1344 | #### cell.style(name, value) ⇒ [<code>Cell</code>](#Cell)
|
1345 | Sets an individual style.
|
1346 |
|
1347 | **Kind**: instance method of [<code>Cell</code>](#Cell)
|
1348 | **Returns**: [<code>Cell</code>](#Cell) - The cell.
|
1349 |
|
1350 | | Param | Type | Description |
|
1351 | | --- | --- | --- |
|
1352 | | name | <code>string</code> | The name of the style. |
|
1353 | | value | <code>\*</code> | The value to set. |
|
1354 |
|
1355 | <a name="Cell+style"></a>
|
1356 |
|
1357 | #### cell.style(name) ⇒ [<code>Range</code>](#Range)
|
1358 | Sets the styles in the range starting with the cell.
|
1359 |
|
1360 | **Kind**: instance method of [<code>Cell</code>](#Cell)
|
1361 | **Returns**: [<code>Range</code>](#Range) - The range that was set.
|
1362 |
|
1363 | | Param | Type | Description |
|
1364 | | --- | --- | --- |
|
1365 | | name | <code>string</code> | The name of the style. |
|
1366 | | | <code>Array.<Array.<\*>></code> | 2D array of values to set. |
|
1367 |
|
1368 | <a name="Cell+style"></a>
|
1369 |
|
1370 | #### cell.style(styles) ⇒ [<code>Cell</code>](#Cell)
|
1371 | Sets multiple styles.
|
1372 |
|
1373 | **Kind**: instance method of [<code>Cell</code>](#Cell)
|
1374 | **Returns**: [<code>Cell</code>](#Cell) - The cell.
|
1375 |
|
1376 | | Param | Type | Description |
|
1377 | | --- | --- | --- |
|
1378 | | styles | <code>object.<string, \*></code> | Object whose keys are the style names and values are the styles to set. |
|
1379 |
|
1380 | <a name="Cell+style"></a>
|
1381 |
|
1382 | #### cell.style(style) ⇒ [<code>Cell</code>](#Cell)
|
1383 | Sets to a specific style
|
1384 |
|
1385 | **Kind**: instance method of [<code>Cell</code>](#Cell)
|
1386 | **Returns**: [<code>Cell</code>](#Cell) - The cell.
|
1387 |
|
1388 | | Param | Type | Description |
|
1389 | | --- | --- | --- |
|
1390 | | style | [<code>Style</code>](#new_Style_new) | Style object given from stylesheet.createStyle |
|
1391 |
|
1392 | <a name="Cell+value"></a>
|
1393 |
|
1394 | #### cell.value() ⇒ <code>string</code> \| <code>boolean</code> \| <code>number</code> \| <code>Date</code> \| [<code>RichText</code>](#RichText) \| <code>undefined</code>
|
1395 | Gets the value of the cell.
|
1396 |
|
1397 | **Kind**: instance method of [<code>Cell</code>](#Cell)
|
1398 | **Returns**: <code>string</code> \| <code>boolean</code> \| <code>number</code> \| <code>Date</code> \| [<code>RichText</code>](#RichText) \| <code>undefined</code> - The value of the cell.
|
1399 | <a name="Cell+value"></a>
|
1400 |
|
1401 | #### cell.value(value) ⇒ [<code>Cell</code>](#Cell)
|
1402 | Sets the value of the cell.
|
1403 |
|
1404 | **Kind**: instance method of [<code>Cell</code>](#Cell)
|
1405 | **Returns**: [<code>Cell</code>](#Cell) - The cell.
|
1406 |
|
1407 | | Param | Type | Description |
|
1408 | | --- | --- | --- |
|
1409 | | value | <code>string</code> \| <code>boolean</code> \| <code>number</code> \| <code>null</code> \| <code>undefined</code> \| [<code>RichText</code>](#RichText) | The value to set. |
|
1410 |
|
1411 | <a name="Cell+value"></a>
|
1412 |
|
1413 | #### cell.value() ⇒ [<code>Range</code>](#Range)
|
1414 | Sets the values in the range starting with the cell.
|
1415 |
|
1416 | **Kind**: instance method of [<code>Cell</code>](#Cell)
|
1417 | **Returns**: [<code>Range</code>](#Range) - The range that was set.
|
1418 |
|
1419 | | Param | Type | Description |
|
1420 | | --- | --- | --- |
|
1421 | | | <code>Array.<Array.<(string\|boolean\|number\|null\|undefined)>></code> | 2D array of values to set. |
|
1422 |
|
1423 | <a name="Cell+workbook"></a>
|
1424 |
|
1425 | #### cell.workbook() ⇒ [<code>Workbook</code>](#Workbook)
|
1426 | Gets the parent workbook.
|
1427 |
|
1428 | **Kind**: instance method of [<code>Cell</code>](#Cell)
|
1429 | **Returns**: [<code>Workbook</code>](#Workbook) - The parent workbook.
|
1430 | <a name="Cell+addHorizontalPageBreak"></a>
|
1431 |
|
1432 | #### cell.addHorizontalPageBreak() ⇒ [<code>Cell</code>](#Cell)
|
1433 | Append horizontal page break after the cell.
|
1434 |
|
1435 | **Kind**: instance method of [<code>Cell</code>](#Cell)
|
1436 | **Returns**: [<code>Cell</code>](#Cell) - the cell.
|
1437 | <a name="Cell..tapCallback"></a>
|
1438 |
|
1439 | #### Cell~tapCallback ⇒ <code>undefined</code>
|
1440 | Callback used by tap.
|
1441 |
|
1442 | **Kind**: inner typedef of [<code>Cell</code>](#Cell)
|
1443 |
|
1444 | | Param | Type | Description |
|
1445 | | --- | --- | --- |
|
1446 | | cell | [<code>Cell</code>](#Cell) | The cell |
|
1447 |
|
1448 | <a name="Cell..thruCallback"></a>
|
1449 |
|
1450 | #### Cell~thruCallback ⇒ <code>\*</code>
|
1451 | Callback used by thru.
|
1452 |
|
1453 | **Kind**: inner typedef of [<code>Cell</code>](#Cell)
|
1454 | **Returns**: <code>\*</code> - The value to return from thru.
|
1455 |
|
1456 | | Param | Type | Description |
|
1457 | | --- | --- | --- |
|
1458 | | cell | [<code>Cell</code>](#Cell) | The cell |
|
1459 |
|
1460 | <a name="Column"></a>
|
1461 |
|
1462 | ### Column
|
1463 | A column.
|
1464 |
|
1465 | **Kind**: global class
|
1466 |
|
1467 | * [Column](#Column)
|
1468 | * [.address([opts])](#Column+address) ⇒ <code>string</code>
|
1469 | * [.cell(rowNumber)](#Column+cell) ⇒ [<code>Cell</code>](#Cell)
|
1470 | * [.columnName()](#Column+columnName) ⇒ <code>string</code>
|
1471 | * [.columnNumber()](#Column+columnNumber) ⇒ <code>number</code>
|
1472 | * [.hidden()](#Column+hidden) ⇒ <code>boolean</code>
|
1473 | * [.hidden(hidden)](#Column+hidden) ⇒ [<code>Column</code>](#Column)
|
1474 | * [.sheet()](#Column+sheet) ⇒ [<code>Sheet</code>](#Sheet)
|
1475 | * [.style(name)](#Column+style) ⇒ <code>\*</code>
|
1476 | * [.style(names)](#Column+style) ⇒ <code>object.<string, \*></code>
|
1477 | * [.style(name, value)](#Column+style) ⇒ [<code>Cell</code>](#Cell)
|
1478 | * [.style(styles)](#Column+style) ⇒ [<code>Cell</code>](#Cell)
|
1479 | * [.style(style)](#Column+style) ⇒ [<code>Cell</code>](#Cell)
|
1480 | * [.width()](#Column+width) ⇒ <code>undefined</code> \| <code>number</code>
|
1481 | * [.width(width)](#Column+width) ⇒ [<code>Column</code>](#Column)
|
1482 | * [.workbook()](#Column+workbook) ⇒ [<code>Workbook</code>](#Workbook)
|
1483 | * [.addPageBreak()](#Column+addPageBreak) ⇒ [<code>Column</code>](#Column)
|
1484 |
|
1485 | <a name="Column+address"></a>
|
1486 |
|
1487 | #### column.address([opts]) ⇒ <code>string</code>
|
1488 | Get the address of the column.
|
1489 |
|
1490 | **Kind**: instance method of [<code>Column</code>](#Column)
|
1491 | **Returns**: <code>string</code> - The address
|
1492 |
|
1493 | | Param | Type | Description |
|
1494 | | --- | --- | --- |
|
1495 | | [opts] | <code>Object</code> | Options |
|
1496 | | [opts.includeSheetName] | <code>boolean</code> | Include the sheet name in the address. |
|
1497 | | [opts.anchored] | <code>boolean</code> | Anchor the address. |
|
1498 |
|
1499 | <a name="Column+cell"></a>
|
1500 |
|
1501 | #### column.cell(rowNumber) ⇒ [<code>Cell</code>](#Cell)
|
1502 | Get a cell within the column.
|
1503 |
|
1504 | **Kind**: instance method of [<code>Column</code>](#Column)
|
1505 | **Returns**: [<code>Cell</code>](#Cell) - The cell in the column with the given row number.
|
1506 |
|
1507 | | Param | Type | Description |
|
1508 | | --- | --- | --- |
|
1509 | | rowNumber | <code>number</code> | The row number. |
|
1510 |
|
1511 | <a name="Column+columnName"></a>
|
1512 |
|
1513 | #### column.columnName() ⇒ <code>string</code>
|
1514 | Get the name of the column.
|
1515 |
|
1516 | **Kind**: instance method of [<code>Column</code>](#Column)
|
1517 | **Returns**: <code>string</code> - The column name.
|
1518 | <a name="Column+columnNumber"></a>
|
1519 |
|
1520 | #### column.columnNumber() ⇒ <code>number</code>
|
1521 | Get the number of the column.
|
1522 |
|
1523 | **Kind**: instance method of [<code>Column</code>](#Column)
|
1524 | **Returns**: <code>number</code> - The column number.
|
1525 | <a name="Column+hidden"></a>
|
1526 |
|
1527 | #### column.hidden() ⇒ <code>boolean</code>
|
1528 | Gets a value indicating whether the column is hidden.
|
1529 |
|
1530 | **Kind**: instance method of [<code>Column</code>](#Column)
|
1531 | **Returns**: <code>boolean</code> - A flag indicating whether the column is hidden.
|
1532 | <a name="Column+hidden"></a>
|
1533 |
|
1534 | #### column.hidden(hidden) ⇒ [<code>Column</code>](#Column)
|
1535 | Sets whether the column is hidden.
|
1536 |
|
1537 | **Kind**: instance method of [<code>Column</code>](#Column)
|
1538 | **Returns**: [<code>Column</code>](#Column) - The column.
|
1539 |
|
1540 | | Param | Type | Description |
|
1541 | | --- | --- | --- |
|
1542 | | hidden | <code>boolean</code> | A flag indicating whether to hide the column. |
|
1543 |
|
1544 | <a name="Column+sheet"></a>
|
1545 |
|
1546 | #### column.sheet() ⇒ [<code>Sheet</code>](#Sheet)
|
1547 | Get the parent sheet.
|
1548 |
|
1549 | **Kind**: instance method of [<code>Column</code>](#Column)
|
1550 | **Returns**: [<code>Sheet</code>](#Sheet) - The parent sheet.
|
1551 | <a name="Column+style"></a>
|
1552 |
|
1553 | #### column.style(name) ⇒ <code>\*</code>
|
1554 | Gets an individual style.
|
1555 |
|
1556 | **Kind**: instance method of [<code>Column</code>](#Column)
|
1557 | **Returns**: <code>\*</code> - The style.
|
1558 |
|
1559 | | Param | Type | Description |
|
1560 | | --- | --- | --- |
|
1561 | | name | <code>string</code> | The name of the style. |
|
1562 |
|
1563 | <a name="Column+style"></a>
|
1564 |
|
1565 | #### column.style(names) ⇒ <code>object.<string, \*></code>
|
1566 | Gets multiple styles.
|
1567 |
|
1568 | **Kind**: instance method of [<code>Column</code>](#Column)
|
1569 | **Returns**: <code>object.<string, \*></code> - Object whose keys are the style names and values are the styles.
|
1570 |
|
1571 | | Param | Type | Description |
|
1572 | | --- | --- | --- |
|
1573 | | names | <code>Array.<string></code> | The names of the style. |
|
1574 |
|
1575 | <a name="Column+style"></a>
|
1576 |
|
1577 | #### column.style(name, value) ⇒ [<code>Cell</code>](#Cell)
|
1578 | Sets an individual style.
|
1579 |
|
1580 | **Kind**: instance method of [<code>Column</code>](#Column)
|
1581 | **Returns**: [<code>Cell</code>](#Cell) - The cell.
|
1582 |
|
1583 | | Param | Type | Description |
|
1584 | | --- | --- | --- |
|
1585 | | name | <code>string</code> | The name of the style. |
|
1586 | | value | <code>\*</code> | The value to set. |
|
1587 |
|
1588 | <a name="Column+style"></a>
|
1589 |
|
1590 | #### column.style(styles) ⇒ [<code>Cell</code>](#Cell)
|
1591 | Sets multiple styles.
|
1592 |
|
1593 | **Kind**: instance method of [<code>Column</code>](#Column)
|
1594 | **Returns**: [<code>Cell</code>](#Cell) - The cell.
|
1595 |
|
1596 | | Param | Type | Description |
|
1597 | | --- | --- | --- |
|
1598 | | styles | <code>object.<string, \*></code> | Object whose keys are the style names and values are the styles to set. |
|
1599 |
|
1600 | <a name="Column+style"></a>
|
1601 |
|
1602 | #### column.style(style) ⇒ [<code>Cell</code>](#Cell)
|
1603 | Sets to a specific style
|
1604 |
|
1605 | **Kind**: instance method of [<code>Column</code>](#Column)
|
1606 | **Returns**: [<code>Cell</code>](#Cell) - The cell.
|
1607 |
|
1608 | | Param | Type | Description |
|
1609 | | --- | --- | --- |
|
1610 | | style | [<code>Style</code>](#new_Style_new) | Style object given from stylesheet.createStyle |
|
1611 |
|
1612 | <a name="Column+width"></a>
|
1613 |
|
1614 | #### column.width() ⇒ <code>undefined</code> \| <code>number</code>
|
1615 | Gets the width.
|
1616 |
|
1617 | **Kind**: instance method of [<code>Column</code>](#Column)
|
1618 | **Returns**: <code>undefined</code> \| <code>number</code> - The width (or undefined).
|
1619 | <a name="Column+width"></a>
|
1620 |
|
1621 | #### column.width(width) ⇒ [<code>Column</code>](#Column)
|
1622 | Sets the width.
|
1623 |
|
1624 | **Kind**: instance method of [<code>Column</code>](#Column)
|
1625 | **Returns**: [<code>Column</code>](#Column) - The column.
|
1626 |
|
1627 | | Param | Type | Description |
|
1628 | | --- | --- | --- |
|
1629 | | width | <code>number</code> | The width of the column. |
|
1630 |
|
1631 | <a name="Column+workbook"></a>
|
1632 |
|
1633 | #### column.workbook() ⇒ [<code>Workbook</code>](#Workbook)
|
1634 | Get the parent workbook.
|
1635 |
|
1636 | **Kind**: instance method of [<code>Column</code>](#Column)
|
1637 | **Returns**: [<code>Workbook</code>](#Workbook) - The parent workbook.
|
1638 | <a name="Column+addPageBreak"></a>
|
1639 |
|
1640 | #### column.addPageBreak() ⇒ [<code>Column</code>](#Column)
|
1641 | Append vertical page break after the column.
|
1642 |
|
1643 | **Kind**: instance method of [<code>Column</code>](#Column)
|
1644 | **Returns**: [<code>Column</code>](#Column) - the column.
|
1645 | <a name="FormulaError"></a>
|
1646 |
|
1647 | ### FormulaError
|
1648 | A formula error (e.g. #DIV/0!).
|
1649 |
|
1650 | **Kind**: global class
|
1651 |
|
1652 | * [FormulaError](#FormulaError)
|
1653 | * _instance_
|
1654 | * [.error()](#FormulaError+error) ⇒ <code>string</code>
|
1655 | * _static_
|
1656 | * [.DIV0](#FormulaError.DIV0) : [<code>FormulaError</code>](#FormulaError)
|
1657 | * [.NA](#FormulaError.NA) : [<code>FormulaError</code>](#FormulaError)
|
1658 | * [.NAME](#FormulaError.NAME) : [<code>FormulaError</code>](#FormulaError)
|
1659 | * [.NULL](#FormulaError.NULL) : [<code>FormulaError</code>](#FormulaError)
|
1660 | * [.NUM](#FormulaError.NUM) : [<code>FormulaError</code>](#FormulaError)
|
1661 | * [.REF](#FormulaError.REF) : [<code>FormulaError</code>](#FormulaError)
|
1662 | * [.VALUE](#FormulaError.VALUE) : [<code>FormulaError</code>](#FormulaError)
|
1663 |
|
1664 | <a name="FormulaError+error"></a>
|
1665 |
|
1666 | #### formulaError.error() ⇒ <code>string</code>
|
1667 | Get the error code.
|
1668 |
|
1669 | **Kind**: instance method of [<code>FormulaError</code>](#FormulaError)
|
1670 | **Returns**: <code>string</code> - The error code.
|
1671 | <a name="FormulaError.DIV0"></a>
|
1672 |
|
1673 | #### FormulaError.DIV0 : [<code>FormulaError</code>](#FormulaError)
|
1674 | \#DIV/0! error.
|
1675 |
|
1676 | **Kind**: static property of [<code>FormulaError</code>](#FormulaError)
|
1677 | <a name="FormulaError.NA"></a>
|
1678 |
|
1679 | #### FormulaError.NA : [<code>FormulaError</code>](#FormulaError)
|
1680 | \#N/A error.
|
1681 |
|
1682 | **Kind**: static property of [<code>FormulaError</code>](#FormulaError)
|
1683 | <a name="FormulaError.NAME"></a>
|
1684 |
|
1685 | #### FormulaError.NAME : [<code>FormulaError</code>](#FormulaError)
|
1686 | \#NAME? error.
|
1687 |
|
1688 | **Kind**: static property of [<code>FormulaError</code>](#FormulaError)
|
1689 | <a name="FormulaError.NULL"></a>
|
1690 |
|
1691 | #### FormulaError.NULL : [<code>FormulaError</code>](#FormulaError)
|
1692 | \#NULL! error.
|
1693 |
|
1694 | **Kind**: static property of [<code>FormulaError</code>](#FormulaError)
|
1695 | <a name="FormulaError.NUM"></a>
|
1696 |
|
1697 | #### FormulaError.NUM : [<code>FormulaError</code>](#FormulaError)
|
1698 | \#NUM! error.
|
1699 |
|
1700 | **Kind**: static property of [<code>FormulaError</code>](#FormulaError)
|
1701 | <a name="FormulaError.REF"></a>
|
1702 |
|
1703 | #### FormulaError.REF : [<code>FormulaError</code>](#FormulaError)
|
1704 | \#REF! error.
|
1705 |
|
1706 | **Kind**: static property of [<code>FormulaError</code>](#FormulaError)
|
1707 | <a name="FormulaError.VALUE"></a>
|
1708 |
|
1709 | #### FormulaError.VALUE : [<code>FormulaError</code>](#FormulaError)
|
1710 | \#VALUE! error.
|
1711 |
|
1712 | **Kind**: static property of [<code>FormulaError</code>](#FormulaError)
|
1713 | <a name="PageBreaks"></a>
|
1714 |
|
1715 | ### PageBreaks
|
1716 | PageBreaks
|
1717 |
|
1718 | **Kind**: global class
|
1719 |
|
1720 | * [PageBreaks](#PageBreaks)
|
1721 | * [.count](#PageBreaks+count) ⇒ <code>number</code>
|
1722 | * [.list](#PageBreaks+list) ⇒ <code>Array</code>
|
1723 | * [.add(id)](#PageBreaks+add) ⇒ [<code>PageBreaks</code>](#PageBreaks)
|
1724 | * [.remove(index)](#PageBreaks+remove) ⇒ [<code>PageBreaks</code>](#PageBreaks)
|
1725 |
|
1726 | <a name="PageBreaks+count"></a>
|
1727 |
|
1728 | #### pageBreaks.count ⇒ <code>number</code>
|
1729 | get count of the page-breaks
|
1730 |
|
1731 | **Kind**: instance property of [<code>PageBreaks</code>](#PageBreaks)
|
1732 | **Returns**: <code>number</code> - the page-breaks' count
|
1733 | <a name="PageBreaks+list"></a>
|
1734 |
|
1735 | #### pageBreaks.list ⇒ <code>Array</code>
|
1736 | get list of page-breaks
|
1737 |
|
1738 | **Kind**: instance property of [<code>PageBreaks</code>](#PageBreaks)
|
1739 | **Returns**: <code>Array</code> - list of the page-breaks
|
1740 | <a name="PageBreaks+add"></a>
|
1741 |
|
1742 | #### pageBreaks.add(id) ⇒ [<code>PageBreaks</code>](#PageBreaks)
|
1743 | add page-breaks by row/column id
|
1744 |
|
1745 | **Kind**: instance method of [<code>PageBreaks</code>](#PageBreaks)
|
1746 | **Returns**: [<code>PageBreaks</code>](#PageBreaks) - the page-breaks
|
1747 |
|
1748 | | Param | Type | Description |
|
1749 | | --- | --- | --- |
|
1750 | | id | <code>number</code> | row/column id (rowNumber/colNumber) |
|
1751 |
|
1752 | <a name="PageBreaks+remove"></a>
|
1753 |
|
1754 | #### pageBreaks.remove(index) ⇒ [<code>PageBreaks</code>](#PageBreaks)
|
1755 | remove page-breaks by index
|
1756 |
|
1757 | **Kind**: instance method of [<code>PageBreaks</code>](#PageBreaks)
|
1758 | **Returns**: [<code>PageBreaks</code>](#PageBreaks) - the page-breaks
|
1759 |
|
1760 | | Param | Type | Description |
|
1761 | | --- | --- | --- |
|
1762 | | index | <code>number</code> | index of list |
|
1763 |
|
1764 | <a name="Range"></a>
|
1765 |
|
1766 | ### Range
|
1767 | A range of cells.
|
1768 |
|
1769 | **Kind**: global class
|
1770 |
|
1771 | * [Range](#Range)
|
1772 | * _instance_
|
1773 | * [.address([opts])](#Range+address) ⇒ <code>string</code>
|
1774 | * [.cell(ri, ci)](#Range+cell) ⇒ [<code>Cell</code>](#Cell)
|
1775 | * [.autoFilter()](#Range+autoFilter) ⇒ [<code>Range</code>](#Range)
|
1776 | * [.cells()](#Range+cells) ⇒ <code>Array.<Array.<Cell>></code>
|
1777 | * [.clear()](#Range+clear) ⇒ [<code>Range</code>](#Range)
|
1778 | * [.endCell()](#Range+endCell) ⇒ [<code>Cell</code>](#Cell)
|
1779 | * [.forEach(callback)](#Range+forEach) ⇒ [<code>Range</code>](#Range)
|
1780 | * [.formula()](#Range+formula) ⇒ <code>string</code> \| <code>undefined</code>
|
1781 | * [.formula(formula)](#Range+formula) ⇒ [<code>Range</code>](#Range)
|
1782 | * [.map(callback)](#Range+map) ⇒ <code>Array.<Array.<\*>></code>
|
1783 | * [.merged()](#Range+merged) ⇒ <code>boolean</code>
|
1784 | * [.merged(merged)](#Range+merged) ⇒ [<code>Range</code>](#Range)
|
1785 | * [.dataValidation()](#Range+dataValidation) ⇒ <code>object</code> \| <code>undefined</code>
|
1786 | * [.dataValidation(dataValidation)](#Range+dataValidation) ⇒ [<code>Range</code>](#Range)
|
1787 | * [.reduce(callback, [initialValue])](#Range+reduce) ⇒ <code>\*</code>
|
1788 | * [.sheet()](#Range+sheet) ⇒ [<code>Sheet</code>](#Sheet)
|
1789 | * [.startCell()](#Range+startCell) ⇒ [<code>Cell</code>](#Cell)
|
1790 | * [.style(name)](#Range+style) ⇒ <code>Array.<Array.<\*>></code>
|
1791 | * [.style(names)](#Range+style) ⇒ <code>Object.<string, Array.<Array.<\*>>></code>
|
1792 | * [.style(name, callback)](#Range+style) ⇒ [<code>Range</code>](#Range)
|
1793 | * [.style(name, values)](#Range+style) ⇒ [<code>Range</code>](#Range)
|
1794 | * [.style(name, value)](#Range+style) ⇒ [<code>Range</code>](#Range)
|
1795 | * [.style(styles)](#Range+style) ⇒ [<code>Range</code>](#Range)
|
1796 | * [.style(style)](#Range+style) ⇒ [<code>Range</code>](#Range)
|
1797 | * [.tap(callback)](#Range+tap) ⇒ [<code>Range</code>](#Range)
|
1798 | * [.thru(callback)](#Range+thru) ⇒ <code>\*</code>
|
1799 | * [.value()](#Range+value) ⇒ <code>Array.<Array.<\*>></code>
|
1800 | * [.value(callback)](#Range+value) ⇒ [<code>Range</code>](#Range)
|
1801 | * [.value(values)](#Range+value) ⇒ [<code>Range</code>](#Range)
|
1802 | * [.value(value)](#Range+value) ⇒ [<code>Range</code>](#Range)
|
1803 | * [.workbook()](#Range+workbook) ⇒ [<code>Workbook</code>](#Workbook)
|
1804 | * _inner_
|
1805 | * [~forEachCallback](#Range..forEachCallback) ⇒ <code>undefined</code>
|
1806 | * [~mapCallback](#Range..mapCallback) ⇒ <code>\*</code>
|
1807 | * [~reduceCallback](#Range..reduceCallback) ⇒ <code>\*</code>
|
1808 | * [~tapCallback](#Range..tapCallback) ⇒ <code>undefined</code>
|
1809 | * [~thruCallback](#Range..thruCallback) ⇒ <code>\*</code>
|
1810 |
|
1811 | <a name="Range+address"></a>
|
1812 |
|
1813 | #### range.address([opts]) ⇒ <code>string</code>
|
1814 | Get the address of the range.
|
1815 |
|
1816 | **Kind**: instance method of [<code>Range</code>](#Range)
|
1817 | **Returns**: <code>string</code> - The address.
|
1818 |
|
1819 | | Param | Type | Description |
|
1820 | | --- | --- | --- |
|
1821 | | [opts] | <code>Object</code> | Options |
|
1822 | | [opts.includeSheetName] | <code>boolean</code> | Include the sheet name in the address. |
|
1823 | | [opts.startRowAnchored] | <code>boolean</code> | Anchor the start row. |
|
1824 | | [opts.startColumnAnchored] | <code>boolean</code> | Anchor the start column. |
|
1825 | | [opts.endRowAnchored] | <code>boolean</code> | Anchor the end row. |
|
1826 | | [opts.endColumnAnchored] | <code>boolean</code> | Anchor the end column. |
|
1827 | | [opts.anchored] | <code>boolean</code> | Anchor all row and columns. |
|
1828 |
|
1829 | <a name="Range+cell"></a>
|
1830 |
|
1831 | #### range.cell(ri, ci) ⇒ [<code>Cell</code>](#Cell)
|
1832 | Gets a cell within the range.
|
1833 |
|
1834 | **Kind**: instance method of [<code>Range</code>](#Range)
|
1835 | **Returns**: [<code>Cell</code>](#Cell) - The cell.
|
1836 |
|
1837 | | Param | Type | Description |
|
1838 | | --- | --- | --- |
|
1839 | | ri | <code>number</code> | Row index relative to the top-left corner of the range (0-based). |
|
1840 | | ci | <code>number</code> | Column index relative to the top-left corner of the range (0-based). |
|
1841 |
|
1842 | <a name="Range+autoFilter"></a>
|
1843 |
|
1844 | #### range.autoFilter() ⇒ [<code>Range</code>](#Range)
|
1845 | Sets sheet autoFilter to this range.
|
1846 |
|
1847 | **Kind**: instance method of [<code>Range</code>](#Range)
|
1848 | **Returns**: [<code>Range</code>](#Range) - This range.
|
1849 | <a name="Range+cells"></a>
|
1850 |
|
1851 | #### range.cells() ⇒ <code>Array.<Array.<Cell>></code>
|
1852 | Get the cells in the range as a 2D array.
|
1853 |
|
1854 | **Kind**: instance method of [<code>Range</code>](#Range)
|
1855 | **Returns**: <code>Array.<Array.<Cell>></code> - The cells.
|
1856 | <a name="Range+clear"></a>
|
1857 |
|
1858 | #### range.clear() ⇒ [<code>Range</code>](#Range)
|
1859 | Clear the contents of all the cells in the range.
|
1860 |
|
1861 | **Kind**: instance method of [<code>Range</code>](#Range)
|
1862 | **Returns**: [<code>Range</code>](#Range) - The range.
|
1863 | <a name="Range+endCell"></a>
|
1864 |
|
1865 | #### range.endCell() ⇒ [<code>Cell</code>](#Cell)
|
1866 | Get the end cell of the range.
|
1867 |
|
1868 | **Kind**: instance method of [<code>Range</code>](#Range)
|
1869 | **Returns**: [<code>Cell</code>](#Cell) - The end cell.
|
1870 | <a name="Range+forEach"></a>
|
1871 |
|
1872 | #### range.forEach(callback) ⇒ [<code>Range</code>](#Range)
|
1873 | Call a function for each cell in the range. Goes by row then column.
|
1874 |
|
1875 | **Kind**: instance method of [<code>Range</code>](#Range)
|
1876 | **Returns**: [<code>Range</code>](#Range) - The range.
|
1877 |
|
1878 | | Param | Type | Description |
|
1879 | | --- | --- | --- |
|
1880 | | callback | [<code>forEachCallback</code>](#Range..forEachCallback) | Function called for each cell in the range. |
|
1881 |
|
1882 | <a name="Range+formula"></a>
|
1883 |
|
1884 | #### range.formula() ⇒ <code>string</code> \| <code>undefined</code>
|
1885 | Gets the shared formula in the start cell (assuming it's the source of the shared formula).
|
1886 |
|
1887 | **Kind**: instance method of [<code>Range</code>](#Range)
|
1888 | **Returns**: <code>string</code> \| <code>undefined</code> - The shared formula.
|
1889 | <a name="Range+formula"></a>
|
1890 |
|
1891 | #### range.formula(formula) ⇒ [<code>Range</code>](#Range)
|
1892 | Sets the shared formula in the range. The formula will be translated for each cell.
|
1893 |
|
1894 | **Kind**: instance method of [<code>Range</code>](#Range)
|
1895 | **Returns**: [<code>Range</code>](#Range) - The range.
|
1896 |
|
1897 | | Param | Type | Description |
|
1898 | | --- | --- | --- |
|
1899 | | formula | <code>string</code> | The formula to set. |
|
1900 |
|
1901 | <a name="Range+map"></a>
|
1902 |
|
1903 | #### range.map(callback) ⇒ <code>Array.<Array.<\*>></code>
|
1904 | Creates a 2D array of values by running each cell through a callback.
|
1905 |
|
1906 | **Kind**: instance method of [<code>Range</code>](#Range)
|
1907 | **Returns**: <code>Array.<Array.<\*>></code> - The 2D array of return values.
|
1908 |
|
1909 | | Param | Type | Description |
|
1910 | | --- | --- | --- |
|
1911 | | callback | [<code>mapCallback</code>](#Range..mapCallback) | Function called for each cell in the range. |
|
1912 |
|
1913 | <a name="Range+merged"></a>
|
1914 |
|
1915 | #### range.merged() ⇒ <code>boolean</code>
|
1916 | Gets a value indicating whether the cells in the range are merged.
|
1917 |
|
1918 | **Kind**: instance method of [<code>Range</code>](#Range)
|
1919 | **Returns**: <code>boolean</code> - The value.
|
1920 | <a name="Range+merged"></a>
|
1921 |
|
1922 | #### range.merged(merged) ⇒ [<code>Range</code>](#Range)
|
1923 | Sets a value indicating whether the cells in the range should be merged.
|
1924 |
|
1925 | **Kind**: instance method of [<code>Range</code>](#Range)
|
1926 | **Returns**: [<code>Range</code>](#Range) - The range.
|
1927 |
|
1928 | | Param | Type | Description |
|
1929 | | --- | --- | --- |
|
1930 | | merged | <code>boolean</code> | True to merge, false to unmerge. |
|
1931 |
|
1932 | <a name="Range+dataValidation"></a>
|
1933 |
|
1934 | #### range.dataValidation() ⇒ <code>object</code> \| <code>undefined</code>
|
1935 | Gets the data validation object attached to the Range.
|
1936 |
|
1937 | **Kind**: instance method of [<code>Range</code>](#Range)
|
1938 | **Returns**: <code>object</code> \| <code>undefined</code> - The data validation object or undefined if not set.
|
1939 | <a name="Range+dataValidation"></a>
|
1940 |
|
1941 | #### range.dataValidation(dataValidation) ⇒ [<code>Range</code>](#Range)
|
1942 | Set or clear the data validation object of the entire range.
|
1943 |
|
1944 | **Kind**: instance method of [<code>Range</code>](#Range)
|
1945 | **Returns**: [<code>Range</code>](#Range) - The range.
|
1946 |
|
1947 | | Param | Type | Description |
|
1948 | | --- | --- | --- |
|
1949 | | dataValidation | <code>object</code> \| <code>undefined</code> | Object or null to clear. |
|
1950 |
|
1951 | <a name="Range+reduce"></a>
|
1952 |
|
1953 | #### range.reduce(callback, [initialValue]) ⇒ <code>\*</code>
|
1954 | Reduces the range to a single value accumulated from the result of a function called for each cell.
|
1955 |
|
1956 | **Kind**: instance method of [<code>Range</code>](#Range)
|
1957 | **Returns**: <code>\*</code> - The accumulated value.
|
1958 |
|
1959 | | Param | Type | Description |
|
1960 | | --- | --- | --- |
|
1961 | | callback | [<code>reduceCallback</code>](#Range..reduceCallback) | Function called for each cell in the range. |
|
1962 | | [initialValue] | <code>\*</code> | The initial value. |
|
1963 |
|
1964 | <a name="Range+sheet"></a>
|
1965 |
|
1966 | #### range.sheet() ⇒ [<code>Sheet</code>](#Sheet)
|
1967 | Gets the parent sheet of the range.
|
1968 |
|
1969 | **Kind**: instance method of [<code>Range</code>](#Range)
|
1970 | **Returns**: [<code>Sheet</code>](#Sheet) - The parent sheet.
|
1971 | <a name="Range+startCell"></a>
|
1972 |
|
1973 | #### range.startCell() ⇒ [<code>Cell</code>](#Cell)
|
1974 | Gets the start cell of the range.
|
1975 |
|
1976 | **Kind**: instance method of [<code>Range</code>](#Range)
|
1977 | **Returns**: [<code>Cell</code>](#Cell) - The start cell.
|
1978 | <a name="Range+style"></a>
|
1979 |
|
1980 | #### range.style(name) ⇒ <code>Array.<Array.<\*>></code>
|
1981 | Gets a single style for each cell.
|
1982 |
|
1983 | **Kind**: instance method of [<code>Range</code>](#Range)
|
1984 | **Returns**: <code>Array.<Array.<\*>></code> - 2D array of style values.
|
1985 |
|
1986 | | Param | Type | Description |
|
1987 | | --- | --- | --- |
|
1988 | | name | <code>string</code> | The name of the style. |
|
1989 |
|
1990 | <a name="Range+style"></a>
|
1991 |
|
1992 | #### range.style(names) ⇒ <code>Object.<string, Array.<Array.<\*>>></code>
|
1993 | Gets multiple styles for each cell.
|
1994 |
|
1995 | **Kind**: instance method of [<code>Range</code>](#Range)
|
1996 | **Returns**: <code>Object.<string, Array.<Array.<\*>>></code> - Object whose keys are style names and values are 2D arrays of style values.
|
1997 |
|
1998 | | Param | Type | Description |
|
1999 | | --- | --- | --- |
|
2000 | | names | <code>Array.<string></code> | The names of the styles. |
|
2001 |
|
2002 | <a name="Range+style"></a>
|
2003 |
|
2004 | #### range.style(name, callback) ⇒ [<code>Range</code>](#Range)
|
2005 | Set the style in each cell to the result of a function called for each.
|
2006 |
|
2007 | **Kind**: instance method of [<code>Range</code>](#Range)
|
2008 | **Returns**: [<code>Range</code>](#Range) - The range.
|
2009 |
|
2010 | | Param | Type | Description |
|
2011 | | --- | --- | --- |
|
2012 | | name | <code>string</code> | The name of the style. |
|
2013 | | callback | [<code>mapCallback</code>](#Range..mapCallback) | The callback to provide value for the cell. |
|
2014 |
|
2015 | <a name="Range+style"></a>
|
2016 |
|
2017 | #### range.style(name, values) ⇒ [<code>Range</code>](#Range)
|
2018 | Sets the style in each cell to the corresponding value in the given 2D array of values.
|
2019 |
|
2020 | **Kind**: instance method of [<code>Range</code>](#Range)
|
2021 | **Returns**: [<code>Range</code>](#Range) - The range.
|
2022 |
|
2023 | | Param | Type | Description |
|
2024 | | --- | --- | --- |
|
2025 | | name | <code>string</code> | The name of the style. |
|
2026 | | values | <code>Array.<Array.<\*>></code> | The style values to set. |
|
2027 |
|
2028 | <a name="Range+style"></a>
|
2029 |
|
2030 | #### range.style(name, value) ⇒ [<code>Range</code>](#Range)
|
2031 | Set the style of all cells in the range to a single style value.
|
2032 |
|
2033 | **Kind**: instance method of [<code>Range</code>](#Range)
|
2034 | **Returns**: [<code>Range</code>](#Range) - The range.
|
2035 |
|
2036 | | Param | Type | Description |
|
2037 | | --- | --- | --- |
|
2038 | | name | <code>string</code> | The name of the style. |
|
2039 | | value | <code>\*</code> | The value to set. |
|
2040 |
|
2041 | <a name="Range+style"></a>
|
2042 |
|
2043 | #### range.style(styles) ⇒ [<code>Range</code>](#Range)
|
2044 | Set multiple styles for the cells in the range.
|
2045 |
|
2046 | **Kind**: instance method of [<code>Range</code>](#Range)
|
2047 | **Returns**: [<code>Range</code>](#Range) - The range.
|
2048 |
|
2049 | | Param | Type | Description |
|
2050 | | --- | --- | --- |
|
2051 | | styles | <code>object.<string, (Range~mapCallback\|Array.<Array.<\*>>\|\*)></code> | Object whose keys are style names and values are either function callbacks, 2D arrays of style values, or a single value for all the cells. |
|
2052 |
|
2053 | <a name="Range+style"></a>
|
2054 |
|
2055 | #### range.style(style) ⇒ [<code>Range</code>](#Range)
|
2056 | Sets to a specific style
|
2057 |
|
2058 | **Kind**: instance method of [<code>Range</code>](#Range)
|
2059 | **Returns**: [<code>Range</code>](#Range) - The range.
|
2060 |
|
2061 | | Param | Type | Description |
|
2062 | | --- | --- | --- |
|
2063 | | style | [<code>Style</code>](#new_Style_new) | Style object given from stylesheet.createStyle |
|
2064 |
|
2065 | <a name="Range+tap"></a>
|
2066 |
|
2067 | #### range.tap(callback) ⇒ [<code>Range</code>](#Range)
|
2068 | Invoke a callback on the range and return the range. Useful for method chaining.
|
2069 |
|
2070 | **Kind**: instance method of [<code>Range</code>](#Range)
|
2071 | **Returns**: [<code>Range</code>](#Range) - The range.
|
2072 |
|
2073 | | Param | Type | Description |
|
2074 | | --- | --- | --- |
|
2075 | | callback | [<code>tapCallback</code>](#Range..tapCallback) | The callback function. |
|
2076 |
|
2077 | <a name="Range+thru"></a>
|
2078 |
|
2079 | #### range.thru(callback) ⇒ <code>\*</code>
|
2080 | Invoke a callback on the range and return the value provided by the callback. Useful for method chaining.
|
2081 |
|
2082 | **Kind**: instance method of [<code>Range</code>](#Range)
|
2083 | **Returns**: <code>\*</code> - The return value of the callback.
|
2084 |
|
2085 | | Param | Type | Description |
|
2086 | | --- | --- | --- |
|
2087 | | callback | [<code>thruCallback</code>](#Range..thruCallback) | The callback function. |
|
2088 |
|
2089 | <a name="Range+value"></a>
|
2090 |
|
2091 | #### range.value() ⇒ <code>Array.<Array.<\*>></code>
|
2092 | Get the values of each cell in the range as a 2D array.
|
2093 |
|
2094 | **Kind**: instance method of [<code>Range</code>](#Range)
|
2095 | **Returns**: <code>Array.<Array.<\*>></code> - The values.
|
2096 | <a name="Range+value"></a>
|
2097 |
|
2098 | #### range.value(callback) ⇒ [<code>Range</code>](#Range)
|
2099 | Set the values in each cell to the result of a function called for each.
|
2100 |
|
2101 | **Kind**: instance method of [<code>Range</code>](#Range)
|
2102 | **Returns**: [<code>Range</code>](#Range) - The range.
|
2103 |
|
2104 | | Param | Type | Description |
|
2105 | | --- | --- | --- |
|
2106 | | callback | [<code>mapCallback</code>](#Range..mapCallback) | The callback to provide value for the cell. |
|
2107 |
|
2108 | <a name="Range+value"></a>
|
2109 |
|
2110 | #### range.value(values) ⇒ [<code>Range</code>](#Range)
|
2111 | Sets the value in each cell to the corresponding value in the given 2D array of values.
|
2112 |
|
2113 | **Kind**: instance method of [<code>Range</code>](#Range)
|
2114 | **Returns**: [<code>Range</code>](#Range) - The range.
|
2115 |
|
2116 | | Param | Type | Description |
|
2117 | | --- | --- | --- |
|
2118 | | values | <code>Array.<Array.<\*>></code> | The values to set. |
|
2119 |
|
2120 | <a name="Range+value"></a>
|
2121 |
|
2122 | #### range.value(value) ⇒ [<code>Range</code>](#Range)
|
2123 | Set the value of all cells in the range to a single value.
|
2124 |
|
2125 | **Kind**: instance method of [<code>Range</code>](#Range)
|
2126 | **Returns**: [<code>Range</code>](#Range) - The range.
|
2127 |
|
2128 | | Param | Type | Description |
|
2129 | | --- | --- | --- |
|
2130 | | value | <code>\*</code> | The value to set. |
|
2131 |
|
2132 | <a name="Range+workbook"></a>
|
2133 |
|
2134 | #### range.workbook() ⇒ [<code>Workbook</code>](#Workbook)
|
2135 | Gets the parent workbook.
|
2136 |
|
2137 | **Kind**: instance method of [<code>Range</code>](#Range)
|
2138 | **Returns**: [<code>Workbook</code>](#Workbook) - The parent workbook.
|
2139 | <a name="Range..forEachCallback"></a>
|
2140 |
|
2141 | #### Range~forEachCallback ⇒ <code>undefined</code>
|
2142 | Callback used by forEach.
|
2143 |
|
2144 | **Kind**: inner typedef of [<code>Range</code>](#Range)
|
2145 |
|
2146 | | Param | Type | Description |
|
2147 | | --- | --- | --- |
|
2148 | | cell | [<code>Cell</code>](#Cell) | The cell. |
|
2149 | | ri | <code>number</code> | The relative row index. |
|
2150 | | ci | <code>number</code> | The relative column index. |
|
2151 | | range | [<code>Range</code>](#Range) | The range. |
|
2152 |
|
2153 | <a name="Range..mapCallback"></a>
|
2154 |
|
2155 | #### Range~mapCallback ⇒ <code>\*</code>
|
2156 | Callback used by map.
|
2157 |
|
2158 | **Kind**: inner typedef of [<code>Range</code>](#Range)
|
2159 | **Returns**: <code>\*</code> - The value to map to.
|
2160 |
|
2161 | | Param | Type | Description |
|
2162 | | --- | --- | --- |
|
2163 | | cell | [<code>Cell</code>](#Cell) | The cell. |
|
2164 | | ri | <code>number</code> | The relative row index. |
|
2165 | | ci | <code>number</code> | The relative column index. |
|
2166 | | range | [<code>Range</code>](#Range) | The range. |
|
2167 |
|
2168 | <a name="Range..reduceCallback"></a>
|
2169 |
|
2170 | #### Range~reduceCallback ⇒ <code>\*</code>
|
2171 | Callback used by reduce.
|
2172 |
|
2173 | **Kind**: inner typedef of [<code>Range</code>](#Range)
|
2174 | **Returns**: <code>\*</code> - The value to map to.
|
2175 |
|
2176 | | Param | Type | Description |
|
2177 | | --- | --- | --- |
|
2178 | | accumulator | <code>\*</code> | The accumulated value. |
|
2179 | | cell | [<code>Cell</code>](#Cell) | The cell. |
|
2180 | | ri | <code>number</code> | The relative row index. |
|
2181 | | ci | <code>number</code> | The relative column index. |
|
2182 | | range | [<code>Range</code>](#Range) | The range. |
|
2183 |
|
2184 | <a name="Range..tapCallback"></a>
|
2185 |
|
2186 | #### Range~tapCallback ⇒ <code>undefined</code>
|
2187 | Callback used by tap.
|
2188 |
|
2189 | **Kind**: inner typedef of [<code>Range</code>](#Range)
|
2190 |
|
2191 | | Param | Type | Description |
|
2192 | | --- | --- | --- |
|
2193 | | range | [<code>Range</code>](#Range) | The range. |
|
2194 |
|
2195 | <a name="Range..thruCallback"></a>
|
2196 |
|
2197 | #### Range~thruCallback ⇒ <code>\*</code>
|
2198 | Callback used by thru.
|
2199 |
|
2200 | **Kind**: inner typedef of [<code>Range</code>](#Range)
|
2201 | **Returns**: <code>\*</code> - The value to return from thru.
|
2202 |
|
2203 | | Param | Type | Description |
|
2204 | | --- | --- | --- |
|
2205 | | range | [<code>Range</code>](#Range) | The range. |
|
2206 |
|
2207 | <a name="RichText"></a>
|
2208 |
|
2209 | ### RichText
|
2210 | A RichText class that contains many [RichTextFragment](#RichTextFragment).
|
2211 |
|
2212 | **Kind**: global class
|
2213 |
|
2214 | * [RichText](#RichText)
|
2215 | * [new RichText([node])](#new_RichText_new)
|
2216 | * [.cell](#RichText+cell) ⇒ [<code>Cell</code>](#Cell) \| <code>undefined</code>
|
2217 | * [.length](#RichText+length) ⇒ <code>number</code>
|
2218 | * [.text()](#RichText+text) ⇒ <code>string</code>
|
2219 | * [.getInstanceWithCellRef(cell)](#RichText+getInstanceWithCellRef) ⇒ [<code>RichText</code>](#RichText)
|
2220 | * [.copy([cell])](#RichText+copy) ⇒ [<code>RichText</code>](#RichText)
|
2221 | * [.get(index)](#RichText+get) ⇒ [<code>RichTextFragment</code>](#RichTextFragment)
|
2222 | * [.remove(index)](#RichText+remove) ⇒ [<code>RichText</code>](#RichText)
|
2223 | * [.add(text, [styles], [index])](#RichText+add) ⇒ [<code>RichText</code>](#RichText)
|
2224 | * [.clear()](#RichText+clear) ⇒ [<code>RichText</code>](#RichText)
|
2225 | * [.removeUnsupportedNodes()](#RichText+removeUnsupportedNodes) ⇒ <code>undefined</code>
|
2226 |
|
2227 | <a name="new_RichText_new"></a>
|
2228 |
|
2229 | #### new RichText([node])
|
2230 | Creates a new instance of RichText. If you get the instance by calling `Cell.value()`,
|
2231 | adding a text contains line separator will trigger [Cell.style](Cell.style)('wrapText', true), which
|
2232 | will make MS Excel show the new line. i.e. In MS Excel, Tap "alt+Enter" in a cell, the cell
|
2233 | will set wrap text to true automatically.
|
2234 |
|
2235 |
|
2236 | | Param | Type | Description |
|
2237 | | --- | --- | --- |
|
2238 | | [node] | <code>undefined</code> \| <code>null</code> \| <code>Object</code> | The node stored in the shared string |
|
2239 |
|
2240 | <a name="RichText+cell"></a>
|
2241 |
|
2242 | #### richText.cell ⇒ [<code>Cell</code>](#Cell) \| <code>undefined</code>
|
2243 | Gets which cell this [RichText](#RichText) instance belongs to.
|
2244 |
|
2245 | **Kind**: instance property of [<code>RichText</code>](#RichText)
|
2246 | **Returns**: [<code>Cell</code>](#Cell) \| <code>undefined</code> - The cell this instance belongs to.
|
2247 | <a name="RichText+length"></a>
|
2248 |
|
2249 | #### richText.length ⇒ <code>number</code>
|
2250 | Gets the how many rich text fragment this [RichText](#RichText) instance contains
|
2251 |
|
2252 | **Kind**: instance property of [<code>RichText</code>](#RichText)
|
2253 | **Returns**: <code>number</code> - The number of fragments this [RichText](#RichText) instance has.
|
2254 | <a name="RichText+text"></a>
|
2255 |
|
2256 | #### richText.text() ⇒ <code>string</code>
|
2257 | Gets concatenated text without styles.
|
2258 |
|
2259 | **Kind**: instance method of [<code>RichText</code>](#RichText)
|
2260 | **Returns**: <code>string</code> - concatenated text
|
2261 | <a name="RichText+getInstanceWithCellRef"></a>
|
2262 |
|
2263 | #### richText.getInstanceWithCellRef(cell) ⇒ [<code>RichText</code>](#RichText)
|
2264 | Gets the instance with cell reference defined.
|
2265 |
|
2266 | **Kind**: instance method of [<code>RichText</code>](#RichText)
|
2267 | **Returns**: [<code>RichText</code>](#RichText) - The instance with cell reference defined.
|
2268 |
|
2269 | | Param | Type | Description |
|
2270 | | --- | --- | --- |
|
2271 | | cell | [<code>Cell</code>](#Cell) | Cell reference. |
|
2272 |
|
2273 | <a name="RichText+copy"></a>
|
2274 |
|
2275 | #### richText.copy([cell]) ⇒ [<code>RichText</code>](#RichText)
|
2276 | Returns a deep copy of this instance.
|
2277 | If cell reference is provided, it checks line separators and calls
|
2278 | `cell.style('wrapText', true)` when needed.
|
2279 |
|
2280 | **Kind**: instance method of [<code>RichText</code>](#RichText)
|
2281 | **Returns**: [<code>RichText</code>](#RichText) - A deep copied instance
|
2282 |
|
2283 | | Param | Type | Description |
|
2284 | | --- | --- | --- |
|
2285 | | [cell] | [<code>Cell</code>](#Cell) \| <code>undefined</code> | The cell reference. |
|
2286 |
|
2287 | <a name="RichText+get"></a>
|
2288 |
|
2289 | #### richText.get(index) ⇒ [<code>RichTextFragment</code>](#RichTextFragment)
|
2290 | Gets the ith fragment of this [RichText](#RichText) instance.
|
2291 |
|
2292 | **Kind**: instance method of [<code>RichText</code>](#RichText)
|
2293 | **Returns**: [<code>RichTextFragment</code>](#RichTextFragment) - A rich text fragment
|
2294 |
|
2295 | | Param | Type | Description |
|
2296 | | --- | --- | --- |
|
2297 | | index | <code>number</code> | The index |
|
2298 |
|
2299 | <a name="RichText+remove"></a>
|
2300 |
|
2301 | #### richText.remove(index) ⇒ [<code>RichText</code>](#RichText)
|
2302 | Removes a rich text fragment. This instance will be mutated.
|
2303 |
|
2304 | **Kind**: instance method of [<code>RichText</code>](#RichText)
|
2305 | **Returns**: [<code>RichText</code>](#RichText) - the rich text instance
|
2306 |
|
2307 | | Param | Type | Description |
|
2308 | | --- | --- | --- |
|
2309 | | index | <code>number</code> | the index of the fragment to remove |
|
2310 |
|
2311 | <a name="RichText+add"></a>
|
2312 |
|
2313 | #### richText.add(text, [styles], [index]) ⇒ [<code>RichText</code>](#RichText)
|
2314 | Adds a rich text fragment to the last or after the given index. This instance will be mutated.
|
2315 |
|
2316 | **Kind**: instance method of [<code>RichText</code>](#RichText)
|
2317 | **Returns**: [<code>RichText</code>](#RichText) - the rich text instance
|
2318 |
|
2319 | | Param | Type | Description |
|
2320 | | --- | --- | --- |
|
2321 | | text | <code>string</code> | the text |
|
2322 | | [styles] | <code>Object</code> | the styles js object, i.e. {fontSize: 12} |
|
2323 | | [index] | <code>number</code> \| <code>undefined</code> \| <code>null</code> | the index of the fragment to add |
|
2324 |
|
2325 | <a name="RichText+clear"></a>
|
2326 |
|
2327 | #### richText.clear() ⇒ [<code>RichText</code>](#RichText)
|
2328 | Clears this rich text
|
2329 |
|
2330 | **Kind**: instance method of [<code>RichText</code>](#RichText)
|
2331 | **Returns**: [<code>RichText</code>](#RichText) - the rich text instance
|
2332 | <a name="RichText+removeUnsupportedNodes"></a>
|
2333 |
|
2334 | #### richText.removeUnsupportedNodes() ⇒ <code>undefined</code>
|
2335 | Remove all unsupported nodes (phoneticPr, rPh for Japanese language).
|
2336 |
|
2337 | **Kind**: instance method of [<code>RichText</code>](#RichText)
|
2338 | <a name="RichTextFragment"></a>
|
2339 |
|
2340 | ### RichTextFragment
|
2341 | A Rich text fragment.
|
2342 |
|
2343 | **Kind**: global class
|
2344 |
|
2345 | * [RichTextFragment](#RichTextFragment)
|
2346 | * [new RichTextFragment(value, [styles], richText)](#new_RichTextFragment_new)
|
2347 | * [.value()](#RichTextFragment+value) ⇒ <code>string</code>
|
2348 | * [.value(text)](#RichTextFragment+value) ⇒ [<code>RichTextFragment</code>](#RichTextFragment)
|
2349 | * [.style(name)](#RichTextFragment+style) ⇒ <code>\*</code>
|
2350 | * [.style(names)](#RichTextFragment+style) ⇒ <code>object.<string, \*></code>
|
2351 | * [.style(name, value)](#RichTextFragment+style) ⇒ [<code>RichTextFragment</code>](#RichTextFragment)
|
2352 | * [.style(styles)](#RichTextFragment+style) ⇒ [<code>RichTextFragment</code>](#RichTextFragment)
|
2353 |
|
2354 | <a name="new_RichTextFragment_new"></a>
|
2355 |
|
2356 | #### new RichTextFragment(value, [styles], richText)
|
2357 | Creates a new instance of RichTextFragment.
|
2358 |
|
2359 |
|
2360 | | Param | Type | Description |
|
2361 | | --- | --- | --- |
|
2362 | | value | <code>string</code> \| <code>Object</code> | Text value or XML node |
|
2363 | | [styles] | <code>object</code> \| <code>undefined</code> \| <code>null</code> | Multiple styles. |
|
2364 | | richText | [<code>RichText</code>](#RichText) | The rich text instance where this fragment belongs to. |
|
2365 |
|
2366 | <a name="RichTextFragment+value"></a>
|
2367 |
|
2368 | #### richTextFragment.value() ⇒ <code>string</code>
|
2369 | Gets the value of this part of rich text
|
2370 |
|
2371 | **Kind**: instance method of [<code>RichTextFragment</code>](#RichTextFragment)
|
2372 | **Returns**: <code>string</code> - text
|
2373 | <a name="RichTextFragment+value"></a>
|
2374 |
|
2375 | #### richTextFragment.value(text) ⇒ [<code>RichTextFragment</code>](#RichTextFragment)
|
2376 | Sets the value of this part of rich text
|
2377 |
|
2378 | **Kind**: instance method of [<code>RichTextFragment</code>](#RichTextFragment)
|
2379 | **Returns**: [<code>RichTextFragment</code>](#RichTextFragment) - - RichTextFragment
|
2380 |
|
2381 | | Param | Type | Description |
|
2382 | | --- | --- | --- |
|
2383 | | text | <code>string</code> | the text to set |
|
2384 |
|
2385 | <a name="RichTextFragment+style"></a>
|
2386 |
|
2387 | #### richTextFragment.style(name) ⇒ <code>\*</code>
|
2388 | Gets an individual style.
|
2389 |
|
2390 | **Kind**: instance method of [<code>RichTextFragment</code>](#RichTextFragment)
|
2391 | **Returns**: <code>\*</code> - The style.
|
2392 |
|
2393 | | Param | Type | Description |
|
2394 | | --- | --- | --- |
|
2395 | | name | <code>string</code> | The name of the style. |
|
2396 |
|
2397 | <a name="RichTextFragment+style"></a>
|
2398 |
|
2399 | #### richTextFragment.style(names) ⇒ <code>object.<string, \*></code>
|
2400 | Gets multiple styles.
|
2401 |
|
2402 | **Kind**: instance method of [<code>RichTextFragment</code>](#RichTextFragment)
|
2403 | **Returns**: <code>object.<string, \*></code> - Object whose keys are the style names and values are the styles.
|
2404 |
|
2405 | | Param | Type | Description |
|
2406 | | --- | --- | --- |
|
2407 | | names | <code>Array.<string></code> | The names of the style. |
|
2408 |
|
2409 | <a name="RichTextFragment+style"></a>
|
2410 |
|
2411 | #### richTextFragment.style(name, value) ⇒ [<code>RichTextFragment</code>](#RichTextFragment)
|
2412 | Sets an individual style.
|
2413 |
|
2414 | **Kind**: instance method of [<code>RichTextFragment</code>](#RichTextFragment)
|
2415 | **Returns**: [<code>RichTextFragment</code>](#RichTextFragment) - This RichTextFragment.
|
2416 |
|
2417 | | Param | Type | Description |
|
2418 | | --- | --- | --- |
|
2419 | | name | <code>string</code> | The name of the style. |
|
2420 | | value | <code>\*</code> | The value to set. |
|
2421 |
|
2422 | <a name="RichTextFragment+style"></a>
|
2423 |
|
2424 | #### richTextFragment.style(styles) ⇒ [<code>RichTextFragment</code>](#RichTextFragment)
|
2425 | Sets multiple styles.
|
2426 |
|
2427 | **Kind**: instance method of [<code>RichTextFragment</code>](#RichTextFragment)
|
2428 | **Returns**: [<code>RichTextFragment</code>](#RichTextFragment) - This RichTextFragment.
|
2429 |
|
2430 | | Param | Type | Description |
|
2431 | | --- | --- | --- |
|
2432 | | styles | <code>object.<string, \*></code> | Object whose keys are the style names and values are the styles to set. |
|
2433 |
|
2434 | <a name="Row"></a>
|
2435 |
|
2436 | ### Row
|
2437 | A row.
|
2438 |
|
2439 | **Kind**: global class
|
2440 |
|
2441 | * [Row](#Row)
|
2442 | * [.address([opts])](#Row+address) ⇒ <code>string</code>
|
2443 | * [.cell(columnNameOrNumber)](#Row+cell) ⇒ [<code>Cell</code>](#Cell)
|
2444 | * [.height()](#Row+height) ⇒ <code>undefined</code> \| <code>number</code>
|
2445 | * [.height(height)](#Row+height) ⇒ [<code>Row</code>](#Row)
|
2446 | * [.hidden()](#Row+hidden) ⇒ <code>boolean</code>
|
2447 | * [.hidden(hidden)](#Row+hidden) ⇒ [<code>Row</code>](#Row)
|
2448 | * [.rowNumber()](#Row+rowNumber) ⇒ <code>number</code>
|
2449 | * [.sheet()](#Row+sheet) ⇒ [<code>Sheet</code>](#Sheet)
|
2450 | * [.style(name)](#Row+style) ⇒ <code>\*</code>
|
2451 | * [.style(names)](#Row+style) ⇒ <code>object.<string, \*></code>
|
2452 | * [.style(name, value)](#Row+style) ⇒ [<code>Cell</code>](#Cell)
|
2453 | * [.style(styles)](#Row+style) ⇒ [<code>Cell</code>](#Cell)
|
2454 | * [.style(style)](#Row+style) ⇒ [<code>Cell</code>](#Cell)
|
2455 | * [.workbook()](#Row+workbook) ⇒ [<code>Workbook</code>](#Workbook)
|
2456 | * [.addPageBreak()](#Row+addPageBreak) ⇒ [<code>Row</code>](#Row)
|
2457 |
|
2458 | <a name="Row+address"></a>
|
2459 |
|
2460 | #### row.address([opts]) ⇒ <code>string</code>
|
2461 | Get the address of the row.
|
2462 |
|
2463 | **Kind**: instance method of [<code>Row</code>](#Row)
|
2464 | **Returns**: <code>string</code> - The address
|
2465 |
|
2466 | | Param | Type | Description |
|
2467 | | --- | --- | --- |
|
2468 | | [opts] | <code>Object</code> | Options |
|
2469 | | [opts.includeSheetName] | <code>boolean</code> | Include the sheet name in the address. |
|
2470 | | [opts.anchored] | <code>boolean</code> | Anchor the address. |
|
2471 |
|
2472 | <a name="Row+cell"></a>
|
2473 |
|
2474 | #### row.cell(columnNameOrNumber) ⇒ [<code>Cell</code>](#Cell)
|
2475 | Get a cell in the row.
|
2476 |
|
2477 | **Kind**: instance method of [<code>Row</code>](#Row)
|
2478 | **Returns**: [<code>Cell</code>](#Cell) - The cell.
|
2479 |
|
2480 | | Param | Type | Description |
|
2481 | | --- | --- | --- |
|
2482 | | columnNameOrNumber | <code>string</code> \| <code>number</code> | The name or number of the column. |
|
2483 |
|
2484 | <a name="Row+height"></a>
|
2485 |
|
2486 | #### row.height() ⇒ <code>undefined</code> \| <code>number</code>
|
2487 | Gets the row height.
|
2488 |
|
2489 | **Kind**: instance method of [<code>Row</code>](#Row)
|
2490 | **Returns**: <code>undefined</code> \| <code>number</code> - The height (or undefined).
|
2491 | <a name="Row+height"></a>
|
2492 |
|
2493 | #### row.height(height) ⇒ [<code>Row</code>](#Row)
|
2494 | Sets the row height.
|
2495 |
|
2496 | **Kind**: instance method of [<code>Row</code>](#Row)
|
2497 | **Returns**: [<code>Row</code>](#Row) - The row.
|
2498 |
|
2499 | | Param | Type | Description |
|
2500 | | --- | --- | --- |
|
2501 | | height | <code>number</code> | The height of the row. |
|
2502 |
|
2503 | <a name="Row+hidden"></a>
|
2504 |
|
2505 | #### row.hidden() ⇒ <code>boolean</code>
|
2506 | Gets a value indicating whether the row is hidden.
|
2507 |
|
2508 | **Kind**: instance method of [<code>Row</code>](#Row)
|
2509 | **Returns**: <code>boolean</code> - A flag indicating whether the row is hidden.
|
2510 | <a name="Row+hidden"></a>
|
2511 |
|
2512 | #### row.hidden(hidden) ⇒ [<code>Row</code>](#Row)
|
2513 | Sets whether the row is hidden.
|
2514 |
|
2515 | **Kind**: instance method of [<code>Row</code>](#Row)
|
2516 | **Returns**: [<code>Row</code>](#Row) - The row.
|
2517 |
|
2518 | | Param | Type | Description |
|
2519 | | --- | --- | --- |
|
2520 | | hidden | <code>boolean</code> | A flag indicating whether to hide the row. |
|
2521 |
|
2522 | <a name="Row+rowNumber"></a>
|
2523 |
|
2524 | #### row.rowNumber() ⇒ <code>number</code>
|
2525 | Gets the row number.
|
2526 |
|
2527 | **Kind**: instance method of [<code>Row</code>](#Row)
|
2528 | **Returns**: <code>number</code> - The row number.
|
2529 | <a name="Row+sheet"></a>
|
2530 |
|
2531 | #### row.sheet() ⇒ [<code>Sheet</code>](#Sheet)
|
2532 | Gets the parent sheet of the row.
|
2533 |
|
2534 | **Kind**: instance method of [<code>Row</code>](#Row)
|
2535 | **Returns**: [<code>Sheet</code>](#Sheet) - The parent sheet.
|
2536 | <a name="Row+style"></a>
|
2537 |
|
2538 | #### row.style(name) ⇒ <code>\*</code>
|
2539 | Gets an individual style.
|
2540 |
|
2541 | **Kind**: instance method of [<code>Row</code>](#Row)
|
2542 | **Returns**: <code>\*</code> - The style.
|
2543 |
|
2544 | | Param | Type | Description |
|
2545 | | --- | --- | --- |
|
2546 | | name | <code>string</code> | The name of the style. |
|
2547 |
|
2548 | <a name="Row+style"></a>
|
2549 |
|
2550 | #### row.style(names) ⇒ <code>object.<string, \*></code>
|
2551 | Gets multiple styles.
|
2552 |
|
2553 | **Kind**: instance method of [<code>Row</code>](#Row)
|
2554 | **Returns**: <code>object.<string, \*></code> - Object whose keys are the style names and values are the styles.
|
2555 |
|
2556 | | Param | Type | Description |
|
2557 | | --- | --- | --- |
|
2558 | | names | <code>Array.<string></code> | The names of the style. |
|
2559 |
|
2560 | <a name="Row+style"></a>
|
2561 |
|
2562 | #### row.style(name, value) ⇒ [<code>Cell</code>](#Cell)
|
2563 | Sets an individual style.
|
2564 |
|
2565 | **Kind**: instance method of [<code>Row</code>](#Row)
|
2566 | **Returns**: [<code>Cell</code>](#Cell) - The cell.
|
2567 |
|
2568 | | Param | Type | Description |
|
2569 | | --- | --- | --- |
|
2570 | | name | <code>string</code> | The name of the style. |
|
2571 | | value | <code>\*</code> | The value to set. |
|
2572 |
|
2573 | <a name="Row+style"></a>
|
2574 |
|
2575 | #### row.style(styles) ⇒ [<code>Cell</code>](#Cell)
|
2576 | Sets multiple styles.
|
2577 |
|
2578 | **Kind**: instance method of [<code>Row</code>](#Row)
|
2579 | **Returns**: [<code>Cell</code>](#Cell) - The cell.
|
2580 |
|
2581 | | Param | Type | Description |
|
2582 | | --- | --- | --- |
|
2583 | | styles | <code>object.<string, \*></code> | Object whose keys are the style names and values are the styles to set. |
|
2584 |
|
2585 | <a name="Row+style"></a>
|
2586 |
|
2587 | #### row.style(style) ⇒ [<code>Cell</code>](#Cell)
|
2588 | Sets to a specific style
|
2589 |
|
2590 | **Kind**: instance method of [<code>Row</code>](#Row)
|
2591 | **Returns**: [<code>Cell</code>](#Cell) - The cell.
|
2592 |
|
2593 | | Param | Type | Description |
|
2594 | | --- | --- | --- |
|
2595 | | style | [<code>Style</code>](#new_Style_new) | Style object given from stylesheet.createStyle |
|
2596 |
|
2597 | <a name="Row+workbook"></a>
|
2598 |
|
2599 | #### row.workbook() ⇒ [<code>Workbook</code>](#Workbook)
|
2600 | Get the parent workbook.
|
2601 |
|
2602 | **Kind**: instance method of [<code>Row</code>](#Row)
|
2603 | **Returns**: [<code>Workbook</code>](#Workbook) - The parent workbook.
|
2604 | <a name="Row+addPageBreak"></a>
|
2605 |
|
2606 | #### row.addPageBreak() ⇒ [<code>Row</code>](#Row)
|
2607 | Append horizontal page break after the row.
|
2608 |
|
2609 | **Kind**: instance method of [<code>Row</code>](#Row)
|
2610 | **Returns**: [<code>Row</code>](#Row) - the row.
|
2611 | <a name="Sheet"></a>
|
2612 |
|
2613 | ### Sheet
|
2614 | A worksheet.
|
2615 |
|
2616 | **Kind**: global class
|
2617 |
|
2618 | * [Sheet](#Sheet)
|
2619 | * [.active()](#Sheet+active) ⇒ <code>boolean</code>
|
2620 | * [.active(active)](#Sheet+active) ⇒ [<code>Sheet</code>](#Sheet)
|
2621 | * [.activeCell()](#Sheet+activeCell) ⇒ [<code>Cell</code>](#Cell)
|
2622 | * [.activeCell(cell)](#Sheet+activeCell) ⇒ [<code>Sheet</code>](#Sheet)
|
2623 | * [.activeCell(rowNumber, columnNameOrNumber)](#Sheet+activeCell) ⇒ [<code>Sheet</code>](#Sheet)
|
2624 | * [.cell(address)](#Sheet+cell) ⇒ [<code>Cell</code>](#Cell)
|
2625 | * [.cell(rowNumber, columnNameOrNumber)](#Sheet+cell) ⇒ [<code>Cell</code>](#Cell)
|
2626 | * [.column(columnNameOrNumber)](#Sheet+column) ⇒ [<code>Column</code>](#Column)
|
2627 | * [.definedName(name)](#Sheet+definedName) ⇒ <code>undefined</code> \| <code>string</code> \| [<code>Cell</code>](#Cell) \| [<code>Range</code>](#Range) \| [<code>Row</code>](#Row) \| [<code>Column</code>](#Column)
|
2628 | * [.definedName(name, refersTo)](#Sheet+definedName) ⇒ [<code>Workbook</code>](#Workbook)
|
2629 | * [.delete()](#Sheet+delete) ⇒ [<code>Workbook</code>](#Workbook)
|
2630 | * [.find(pattern, [replacement])](#Sheet+find) ⇒ [<code>Array.<Cell></code>](#Cell)
|
2631 | * [.gridLinesVisible()](#Sheet+gridLinesVisible) ⇒ <code>boolean</code>
|
2632 | * [.gridLinesVisible(selected)](#Sheet+gridLinesVisible) ⇒ [<code>Sheet</code>](#Sheet)
|
2633 | * [.hidden()](#Sheet+hidden) ⇒ <code>boolean</code> \| <code>string</code>
|
2634 | * [.hidden(hidden)](#Sheet+hidden) ⇒ [<code>Sheet</code>](#Sheet)
|
2635 | * [.move([indexOrBeforeSheet])](#Sheet+move) ⇒ [<code>Sheet</code>](#Sheet)
|
2636 | * [.name()](#Sheet+name) ⇒ <code>string</code>
|
2637 | * [.name(name)](#Sheet+name) ⇒ [<code>Sheet</code>](#Sheet)
|
2638 | * [.range(address)](#Sheet+range) ⇒ [<code>Range</code>](#Range)
|
2639 | * [.range(startCell, endCell)](#Sheet+range) ⇒ [<code>Range</code>](#Range)
|
2640 | * [.range(startRowNumber, startColumnNameOrNumber, endRowNumber, endColumnNameOrNumber)](#Sheet+range) ⇒ [<code>Range</code>](#Range)
|
2641 | * [.autoFilter()](#Sheet+autoFilter) ⇒ [<code>Sheet</code>](#Sheet)
|
2642 | * [.autoFilter(range)](#Sheet+autoFilter) ⇒ [<code>Sheet</code>](#Sheet)
|
2643 | * [.row(rowNumber)](#Sheet+row) ⇒ [<code>Row</code>](#Row)
|
2644 | * [.tabColor()](#Sheet+tabColor) ⇒ <code>undefined</code> \| <code>Color</code>
|
2645 | * [.tabColor()](#Sheet+tabColor) ⇒ <code>Color</code> \| <code>string</code> \| <code>number</code>
|
2646 | * [.tabSelected()](#Sheet+tabSelected) ⇒ <code>boolean</code>
|
2647 | * [.tabSelected(selected)](#Sheet+tabSelected) ⇒ [<code>Sheet</code>](#Sheet)
|
2648 | * [.rightToLeft()](#Sheet+rightToLeft) ⇒ <code>boolean</code>
|
2649 | * [.rightToLeft(rtl)](#Sheet+rightToLeft) ⇒ [<code>Sheet</code>](#Sheet)
|
2650 | * [.usedRange()](#Sheet+usedRange) ⇒ [<code>Range</code>](#Range) \| <code>undefined</code>
|
2651 | * [.workbook()](#Sheet+workbook) ⇒ [<code>Workbook</code>](#Workbook)
|
2652 | * [.pageBreaks()](#Sheet+pageBreaks) ⇒ <code>Object</code>
|
2653 | * [.verticalPageBreaks()](#Sheet+verticalPageBreaks) ⇒ [<code>PageBreaks</code>](#PageBreaks)
|
2654 | * [.horizontalPageBreaks()](#Sheet+horizontalPageBreaks) ⇒ [<code>PageBreaks</code>](#PageBreaks)
|
2655 | * [.hyperlink(address)](#Sheet+hyperlink) ⇒ <code>string</code> \| <code>undefined</code>
|
2656 | * [.hyperlink(address, hyperlink, [internal])](#Sheet+hyperlink) ⇒ [<code>Sheet</code>](#Sheet)
|
2657 | * [.hyperlink(address, opts)](#Sheet+hyperlink) ⇒ [<code>Sheet</code>](#Sheet)
|
2658 | * [.printOptions(attributeName)](#Sheet+printOptions) ⇒ <code>boolean</code>
|
2659 | * [.printOptions(attributeName, attributeEnabled)](#Sheet+printOptions) ⇒ [<code>Sheet</code>](#Sheet)
|
2660 | * [.printGridLines()](#Sheet+printGridLines) ⇒ <code>boolean</code>
|
2661 | * [.printGridLines(enabled)](#Sheet+printGridLines) ⇒ [<code>Sheet</code>](#Sheet)
|
2662 | * [.pageMargins(attributeName)](#Sheet+pageMargins) ⇒ <code>number</code>
|
2663 | * [.pageMargins(attributeName, attributeStringValue)](#Sheet+pageMargins) ⇒ [<code>Sheet</code>](#Sheet)
|
2664 | * [.pageMarginsPreset()](#Sheet+pageMarginsPreset) ⇒ <code>string</code>
|
2665 | * [.pageMarginsPreset(presetName)](#Sheet+pageMarginsPreset) ⇒ [<code>Sheet</code>](#Sheet)
|
2666 | * [.pageMarginsPreset(presetName, presetAttributes)](#Sheet+pageMarginsPreset) ⇒ [<code>Sheet</code>](#Sheet)
|
2667 | * [.panes()](#Sheet+panes) ⇒ [<code>PaneOptions</code>](#PaneOptions)
|
2668 | * [.panes(paneOptions)](#Sheet+panes) ⇒ [<code>Sheet</code>](#Sheet)
|
2669 | * [.freezePanes(xSplit, ySplit)](#Sheet+freezePanes) ⇒ [<code>Sheet</code>](#Sheet)
|
2670 | * [.freezePanes(topLeftCell)](#Sheet+freezePanes) ⇒ [<code>Sheet</code>](#Sheet)
|
2671 | * [.splitPanes(xSplit, ySplit)](#Sheet+splitPanes) ⇒ [<code>Sheet</code>](#Sheet)
|
2672 | * [.resetPanes()](#Sheet+resetPanes) ⇒ [<code>Sheet</code>](#Sheet)
|
2673 |
|
2674 | <a name="Sheet+active"></a>
|
2675 |
|
2676 | #### sheet.active() ⇒ <code>boolean</code>
|
2677 | Gets a value indicating whether the sheet is the active sheet in the workbook.
|
2678 |
|
2679 | **Kind**: instance method of [<code>Sheet</code>](#Sheet)
|
2680 | **Returns**: <code>boolean</code> - True if active, false otherwise.
|
2681 | <a name="Sheet+active"></a>
|
2682 |
|
2683 | #### sheet.active(active) ⇒ [<code>Sheet</code>](#Sheet)
|
2684 | Make the sheet the active sheet in the workkbok.
|
2685 |
|
2686 | **Kind**: instance method of [<code>Sheet</code>](#Sheet)
|
2687 | **Returns**: [<code>Sheet</code>](#Sheet) - The sheet.
|
2688 |
|
2689 | | Param | Type | Description |
|
2690 | | --- | --- | --- |
|
2691 | | active | <code>boolean</code> | Must be set to `true`. Deactivating directly is not supported. To deactivate, you should activate a different sheet instead. |
|
2692 |
|
2693 | <a name="Sheet+activeCell"></a>
|
2694 |
|
2695 | #### sheet.activeCell() ⇒ [<code>Cell</code>](#Cell)
|
2696 | Get the active cell in the sheet.
|
2697 |
|
2698 | **Kind**: instance method of [<code>Sheet</code>](#Sheet)
|
2699 | **Returns**: [<code>Cell</code>](#Cell) - The active cell.
|
2700 | <a name="Sheet+activeCell"></a>
|
2701 |
|
2702 | #### sheet.activeCell(cell) ⇒ [<code>Sheet</code>](#Sheet)
|
2703 | Set the active cell in the workbook.
|
2704 |
|
2705 | **Kind**: instance method of [<code>Sheet</code>](#Sheet)
|
2706 | **Returns**: [<code>Sheet</code>](#Sheet) - The sheet.
|
2707 |
|
2708 | | Param | Type | Description |
|
2709 | | --- | --- | --- |
|
2710 | | cell | <code>string</code> \| [<code>Cell</code>](#Cell) | The cell or address of cell to activate. |
|
2711 |
|
2712 | <a name="Sheet+activeCell"></a>
|
2713 |
|
2714 | #### sheet.activeCell(rowNumber, columnNameOrNumber) ⇒ [<code>Sheet</code>](#Sheet)
|
2715 | Set the active cell in the workbook by row and column.
|
2716 |
|
2717 | **Kind**: instance method of [<code>Sheet</code>](#Sheet)
|
2718 | **Returns**: [<code>Sheet</code>](#Sheet) - The sheet.
|
2719 |
|
2720 | | Param | Type | Description |
|
2721 | | --- | --- | --- |
|
2722 | | rowNumber | <code>number</code> | The row number of the cell. |
|
2723 | | columnNameOrNumber | <code>string</code> \| <code>number</code> | The column name or number of the cell. |
|
2724 |
|
2725 | <a name="Sheet+cell"></a>
|
2726 |
|
2727 | #### sheet.cell(address) ⇒ [<code>Cell</code>](#Cell)
|
2728 | Gets the cell with the given address.
|
2729 |
|
2730 | **Kind**: instance method of [<code>Sheet</code>](#Sheet)
|
2731 | **Returns**: [<code>Cell</code>](#Cell) - The cell.
|
2732 |
|
2733 | | Param | Type | Description |
|
2734 | | --- | --- | --- |
|
2735 | | address | <code>string</code> | The address of the cell. |
|
2736 |
|
2737 | <a name="Sheet+cell"></a>
|
2738 |
|
2739 | #### sheet.cell(rowNumber, columnNameOrNumber) ⇒ [<code>Cell</code>](#Cell)
|
2740 | Gets the cell with the given row and column numbers.
|
2741 |
|
2742 | **Kind**: instance method of [<code>Sheet</code>](#Sheet)
|
2743 | **Returns**: [<code>Cell</code>](#Cell) - The cell.
|
2744 |
|
2745 | | Param | Type | Description |
|
2746 | | --- | --- | --- |
|
2747 | | rowNumber | <code>number</code> | The row number of the cell. |
|
2748 | | columnNameOrNumber | <code>string</code> \| <code>number</code> | The column name or number of the cell. |
|
2749 |
|
2750 | <a name="Sheet+column"></a>
|
2751 |
|
2752 | #### sheet.column(columnNameOrNumber) ⇒ [<code>Column</code>](#Column)
|
2753 | Gets a column in the sheet.
|
2754 |
|
2755 | **Kind**: instance method of [<code>Sheet</code>](#Sheet)
|
2756 | **Returns**: [<code>Column</code>](#Column) - The column.
|
2757 |
|
2758 | | Param | Type | Description |
|
2759 | | --- | --- | --- |
|
2760 | | columnNameOrNumber | <code>string</code> \| <code>number</code> | The name or number of the column. |
|
2761 |
|
2762 | <a name="Sheet+definedName"></a>
|
2763 |
|
2764 | #### sheet.definedName(name) ⇒ <code>undefined</code> \| <code>string</code> \| [<code>Cell</code>](#Cell) \| [<code>Range</code>](#Range) \| [<code>Row</code>](#Row) \| [<code>Column</code>](#Column)
|
2765 | Gets a defined name scoped to the sheet.
|
2766 |
|
2767 | **Kind**: instance method of [<code>Sheet</code>](#Sheet)
|
2768 | **Returns**: <code>undefined</code> \| <code>string</code> \| [<code>Cell</code>](#Cell) \| [<code>Range</code>](#Range) \| [<code>Row</code>](#Row) \| [<code>Column</code>](#Column) - What the defined name refers to or undefined if not found. Will return the string formula if not a Row, Column, Cell, or Range.
|
2769 |
|
2770 | | Param | Type | Description |
|
2771 | | --- | --- | --- |
|
2772 | | name | <code>string</code> | The defined name. |
|
2773 |
|
2774 | <a name="Sheet+definedName"></a>
|
2775 |
|
2776 | #### sheet.definedName(name, refersTo) ⇒ [<code>Workbook</code>](#Workbook)
|
2777 | Set a defined name scoped to the sheet.
|
2778 |
|
2779 | **Kind**: instance method of [<code>Sheet</code>](#Sheet)
|
2780 | **Returns**: [<code>Workbook</code>](#Workbook) - The workbook.
|
2781 |
|
2782 | | Param | Type | Description |
|
2783 | | --- | --- | --- |
|
2784 | | name | <code>string</code> | The defined name. |
|
2785 | | refersTo | <code>string</code> \| [<code>Cell</code>](#Cell) \| [<code>Range</code>](#Range) \| [<code>Row</code>](#Row) \| [<code>Column</code>](#Column) | What the name refers to. |
|
2786 |
|
2787 | <a name="Sheet+delete"></a>
|
2788 |
|
2789 | #### sheet.delete() ⇒ [<code>Workbook</code>](#Workbook)
|
2790 | Deletes the sheet and returns the parent workbook.
|
2791 |
|
2792 | **Kind**: instance method of [<code>Sheet</code>](#Sheet)
|
2793 | **Returns**: [<code>Workbook</code>](#Workbook) - The workbook.
|
2794 | <a name="Sheet+find"></a>
|
2795 |
|
2796 | #### sheet.find(pattern, [replacement]) ⇒ [<code>Array.<Cell></code>](#Cell)
|
2797 | Find the given pattern in the sheet and optionally replace it.
|
2798 |
|
2799 | **Kind**: instance method of [<code>Sheet</code>](#Sheet)
|
2800 | **Returns**: [<code>Array.<Cell></code>](#Cell) - The matching cells.
|
2801 |
|
2802 | | Param | Type | Description |
|
2803 | | --- | --- | --- |
|
2804 | | pattern | <code>string</code> \| <code>RegExp</code> | The pattern to look for. Providing a string will result in a case-insensitive substring search. Use a RegExp for more sophisticated searches. |
|
2805 | | [replacement] | <code>string</code> \| <code>function</code> | The text to replace or a String.replace callback function. If pattern is a string, all occurrences of the pattern in each cell will be replaced. |
|
2806 |
|
2807 | <a name="Sheet+gridLinesVisible"></a>
|
2808 |
|
2809 | #### sheet.gridLinesVisible() ⇒ <code>boolean</code>
|
2810 | Gets a value indicating whether this sheet's grid lines are visible.
|
2811 |
|
2812 | **Kind**: instance method of [<code>Sheet</code>](#Sheet)
|
2813 | **Returns**: <code>boolean</code> - True if selected, false if not.
|
2814 | <a name="Sheet+gridLinesVisible"></a>
|
2815 |
|
2816 | #### sheet.gridLinesVisible(selected) ⇒ [<code>Sheet</code>](#Sheet)
|
2817 | Sets whether this sheet's grid lines are visible.
|
2818 |
|
2819 | **Kind**: instance method of [<code>Sheet</code>](#Sheet)
|
2820 | **Returns**: [<code>Sheet</code>](#Sheet) - The sheet.
|
2821 |
|
2822 | | Param | Type | Description |
|
2823 | | --- | --- | --- |
|
2824 | | selected | <code>boolean</code> | True to make visible, false to hide. |
|
2825 |
|
2826 | <a name="Sheet+hidden"></a>
|
2827 |
|
2828 | #### sheet.hidden() ⇒ <code>boolean</code> \| <code>string</code>
|
2829 | Gets a value indicating if the sheet is hidden or not.
|
2830 |
|
2831 | **Kind**: instance method of [<code>Sheet</code>](#Sheet)
|
2832 | **Returns**: <code>boolean</code> \| <code>string</code> - True if hidden, false if visible, and 'very' if very hidden.
|
2833 | <a name="Sheet+hidden"></a>
|
2834 |
|
2835 | #### sheet.hidden(hidden) ⇒ [<code>Sheet</code>](#Sheet)
|
2836 | Set whether the sheet is hidden or not.
|
2837 |
|
2838 | **Kind**: instance method of [<code>Sheet</code>](#Sheet)
|
2839 | **Returns**: [<code>Sheet</code>](#Sheet) - The sheet.
|
2840 |
|
2841 | | Param | Type | Description |
|
2842 | | --- | --- | --- |
|
2843 | | hidden | <code>boolean</code> \| <code>string</code> | True to hide, false to show, and 'very' to make very hidden. |
|
2844 |
|
2845 | <a name="Sheet+move"></a>
|
2846 |
|
2847 | #### sheet.move([indexOrBeforeSheet]) ⇒ [<code>Sheet</code>](#Sheet)
|
2848 | Move the sheet.
|
2849 |
|
2850 | **Kind**: instance method of [<code>Sheet</code>](#Sheet)
|
2851 | **Returns**: [<code>Sheet</code>](#Sheet) - The sheet.
|
2852 |
|
2853 | | Param | Type | Description |
|
2854 | | --- | --- | --- |
|
2855 | | [indexOrBeforeSheet] | <code>number</code> \| <code>string</code> \| [<code>Sheet</code>](#Sheet) | The index to move the sheet to or the sheet (or name of sheet) to move this sheet before. Omit this argument to move to the end of the workbook. |
|
2856 |
|
2857 | <a name="Sheet+name"></a>
|
2858 |
|
2859 | #### sheet.name() ⇒ <code>string</code>
|
2860 | Get the name of the sheet.
|
2861 |
|
2862 | **Kind**: instance method of [<code>Sheet</code>](#Sheet)
|
2863 | **Returns**: <code>string</code> - The sheet name.
|
2864 | <a name="Sheet+name"></a>
|
2865 |
|
2866 | #### sheet.name(name) ⇒ [<code>Sheet</code>](#Sheet)
|
2867 | Set the name of the sheet. *Note: this method does not rename references to the sheet so formulas, etc. can be broken. Use with caution!*
|
2868 |
|
2869 | **Kind**: instance method of [<code>Sheet</code>](#Sheet)
|
2870 | **Returns**: [<code>Sheet</code>](#Sheet) - The sheet.
|
2871 |
|
2872 | | Param | Type | Description |
|
2873 | | --- | --- | --- |
|
2874 | | name | <code>string</code> | The name to set to the sheet. |
|
2875 |
|
2876 | <a name="Sheet+range"></a>
|
2877 |
|
2878 | #### sheet.range(address) ⇒ [<code>Range</code>](#Range)
|
2879 | Gets a range from the given range address.
|
2880 |
|
2881 | **Kind**: instance method of [<code>Sheet</code>](#Sheet)
|
2882 | **Returns**: [<code>Range</code>](#Range) - The range.
|
2883 |
|
2884 | | Param | Type | Description |
|
2885 | | --- | --- | --- |
|
2886 | | address | <code>string</code> | The range address (e.g. 'A1:B3'). |
|
2887 |
|
2888 | <a name="Sheet+range"></a>
|
2889 |
|
2890 | #### sheet.range(startCell, endCell) ⇒ [<code>Range</code>](#Range)
|
2891 | Gets a range from the given cells or cell addresses.
|
2892 |
|
2893 | **Kind**: instance method of [<code>Sheet</code>](#Sheet)
|
2894 | **Returns**: [<code>Range</code>](#Range) - The range.
|
2895 |
|
2896 | | Param | Type | Description |
|
2897 | | --- | --- | --- |
|
2898 | | startCell | <code>string</code> \| [<code>Cell</code>](#Cell) | The starting cell or cell address (e.g. 'A1'). |
|
2899 | | endCell | <code>string</code> \| [<code>Cell</code>](#Cell) | The ending cell or cell address (e.g. 'B3'). |
|
2900 |
|
2901 | <a name="Sheet+range"></a>
|
2902 |
|
2903 | #### sheet.range(startRowNumber, startColumnNameOrNumber, endRowNumber, endColumnNameOrNumber) ⇒ [<code>Range</code>](#Range)
|
2904 | Gets a range from the given row numbers and column names or numbers.
|
2905 |
|
2906 | **Kind**: instance method of [<code>Sheet</code>](#Sheet)
|
2907 | **Returns**: [<code>Range</code>](#Range) - The range.
|
2908 |
|
2909 | | Param | Type | Description |
|
2910 | | --- | --- | --- |
|
2911 | | startRowNumber | <code>number</code> | The starting cell row number. |
|
2912 | | startColumnNameOrNumber | <code>string</code> \| <code>number</code> | The starting cell column name or number. |
|
2913 | | endRowNumber | <code>number</code> | The ending cell row number. |
|
2914 | | endColumnNameOrNumber | <code>string</code> \| <code>number</code> | The ending cell column name or number. |
|
2915 |
|
2916 | <a name="Sheet+autoFilter"></a>
|
2917 |
|
2918 | #### sheet.autoFilter() ⇒ [<code>Sheet</code>](#Sheet)
|
2919 | Unsets sheet autoFilter.
|
2920 |
|
2921 | **Kind**: instance method of [<code>Sheet</code>](#Sheet)
|
2922 | **Returns**: [<code>Sheet</code>](#Sheet) - This sheet.
|
2923 | <a name="Sheet+autoFilter"></a>
|
2924 |
|
2925 | #### sheet.autoFilter(range) ⇒ [<code>Sheet</code>](#Sheet)
|
2926 | Sets sheet autoFilter to a Range.
|
2927 |
|
2928 | **Kind**: instance method of [<code>Sheet</code>](#Sheet)
|
2929 | **Returns**: [<code>Sheet</code>](#Sheet) - This sheet.
|
2930 |
|
2931 | | Param | Type | Description |
|
2932 | | --- | --- | --- |
|
2933 | | range | [<code>Range</code>](#Range) | The autoFilter range. |
|
2934 |
|
2935 | <a name="Sheet+row"></a>
|
2936 |
|
2937 | #### sheet.row(rowNumber) ⇒ [<code>Row</code>](#Row)
|
2938 | Gets the row with the given number.
|
2939 |
|
2940 | **Kind**: instance method of [<code>Sheet</code>](#Sheet)
|
2941 | **Returns**: [<code>Row</code>](#Row) - The row with the given number.
|
2942 |
|
2943 | | Param | Type | Description |
|
2944 | | --- | --- | --- |
|
2945 | | rowNumber | <code>number</code> | The row number. |
|
2946 |
|
2947 | <a name="Sheet+tabColor"></a>
|
2948 |
|
2949 | #### sheet.tabColor() ⇒ <code>undefined</code> \| <code>Color</code>
|
2950 | Get the tab color. (See style [Color](#color).)
|
2951 |
|
2952 | **Kind**: instance method of [<code>Sheet</code>](#Sheet)
|
2953 | **Returns**: <code>undefined</code> \| <code>Color</code> - The color or undefined if not set.
|
2954 | <a name="Sheet+tabColor"></a>
|
2955 |
|
2956 | #### sheet.tabColor() ⇒ <code>Color</code> \| <code>string</code> \| <code>number</code>
|
2957 | Sets the tab color. (See style [Color](#color).)
|
2958 |
|
2959 | **Kind**: instance method of [<code>Sheet</code>](#Sheet)
|
2960 | **Returns**: <code>Color</code> \| <code>string</code> \| <code>number</code> - color - Color of the tab. If string, will set an RGB color. If number, will set a theme color.
|
2961 | <a name="Sheet+tabSelected"></a>
|
2962 |
|
2963 | #### sheet.tabSelected() ⇒ <code>boolean</code>
|
2964 | Gets a value indicating whether this sheet is selected.
|
2965 |
|
2966 | **Kind**: instance method of [<code>Sheet</code>](#Sheet)
|
2967 | **Returns**: <code>boolean</code> - True if selected, false if not.
|
2968 | <a name="Sheet+tabSelected"></a>
|
2969 |
|
2970 | #### sheet.tabSelected(selected) ⇒ [<code>Sheet</code>](#Sheet)
|
2971 | Sets whether this sheet is selected.
|
2972 |
|
2973 | **Kind**: instance method of [<code>Sheet</code>](#Sheet)
|
2974 | **Returns**: [<code>Sheet</code>](#Sheet) - The sheet.
|
2975 |
|
2976 | | Param | Type | Description |
|
2977 | | --- | --- | --- |
|
2978 | | selected | <code>boolean</code> | True to select, false to deselected. |
|
2979 |
|
2980 | <a name="Sheet+rightToLeft"></a>
|
2981 |
|
2982 | #### sheet.rightToLeft() ⇒ <code>boolean</code>
|
2983 | Gets a value indicating whether this sheet is rtl (Right To Left).
|
2984 |
|
2985 | **Kind**: instance method of [<code>Sheet</code>](#Sheet)
|
2986 | **Returns**: <code>boolean</code> - True if rtl, false if ltr.
|
2987 | <a name="Sheet+rightToLeft"></a>
|
2988 |
|
2989 | #### sheet.rightToLeft(rtl) ⇒ [<code>Sheet</code>](#Sheet)
|
2990 | Sets whether this sheet is rtl.
|
2991 |
|
2992 | **Kind**: instance method of [<code>Sheet</code>](#Sheet)
|
2993 | **Returns**: [<code>Sheet</code>](#Sheet) - The sheet.
|
2994 |
|
2995 | | Param | Type | Description |
|
2996 | | --- | --- | --- |
|
2997 | | rtl | <code>boolean</code> | True to rtl, false to ltr (Left To Right). |
|
2998 |
|
2999 | <a name="Sheet+usedRange"></a>
|
3000 |
|
3001 | #### sheet.usedRange() ⇒ [<code>Range</code>](#Range) \| <code>undefined</code>
|
3002 | Get the range of cells in the sheet that have contained a value or style at any point. Useful for extracting the entire sheet contents.
|
3003 |
|
3004 | **Kind**: instance method of [<code>Sheet</code>](#Sheet)
|
3005 | **Returns**: [<code>Range</code>](#Range) \| <code>undefined</code> - The used range or undefined if no cells in the sheet are used.
|
3006 | <a name="Sheet+workbook"></a>
|
3007 |
|
3008 | #### sheet.workbook() ⇒ [<code>Workbook</code>](#Workbook)
|
3009 | Gets the parent workbook.
|
3010 |
|
3011 | **Kind**: instance method of [<code>Sheet</code>](#Sheet)
|
3012 | **Returns**: [<code>Workbook</code>](#Workbook) - The parent workbook.
|
3013 | <a name="Sheet+pageBreaks"></a>
|
3014 |
|
3015 | #### sheet.pageBreaks() ⇒ <code>Object</code>
|
3016 | Gets all page breaks.
|
3017 |
|
3018 | **Kind**: instance method of [<code>Sheet</code>](#Sheet)
|
3019 | **Returns**: <code>Object</code> - the object holds both vertical and horizontal PageBreaks.
|
3020 | <a name="Sheet+verticalPageBreaks"></a>
|
3021 |
|
3022 | #### sheet.verticalPageBreaks() ⇒ [<code>PageBreaks</code>](#PageBreaks)
|
3023 | Gets the vertical page breaks.
|
3024 |
|
3025 | **Kind**: instance method of [<code>Sheet</code>](#Sheet)
|
3026 | **Returns**: [<code>PageBreaks</code>](#PageBreaks) - vertical PageBreaks.
|
3027 | <a name="Sheet+horizontalPageBreaks"></a>
|
3028 |
|
3029 | #### sheet.horizontalPageBreaks() ⇒ [<code>PageBreaks</code>](#PageBreaks)
|
3030 | Gets the horizontal page breaks.
|
3031 |
|
3032 | **Kind**: instance method of [<code>Sheet</code>](#Sheet)
|
3033 | **Returns**: [<code>PageBreaks</code>](#PageBreaks) - horizontal PageBreaks.
|
3034 | <a name="Sheet+hyperlink"></a>
|
3035 |
|
3036 | #### sheet.hyperlink(address) ⇒ <code>string</code> \| <code>undefined</code>
|
3037 | Get the hyperlink attached to the cell with the given address.
|
3038 |
|
3039 | **Kind**: instance method of [<code>Sheet</code>](#Sheet)
|
3040 | **Returns**: <code>string</code> \| <code>undefined</code> - The hyperlink or undefined if not set.
|
3041 |
|
3042 | | Param | Type | Description |
|
3043 | | --- | --- | --- |
|
3044 | | address | <code>string</code> | The address of the hyperlinked cell. |
|
3045 |
|
3046 | <a name="Sheet+hyperlink"></a>
|
3047 |
|
3048 | #### sheet.hyperlink(address, hyperlink, [internal]) ⇒ [<code>Sheet</code>](#Sheet)
|
3049 | Set the hyperlink on the cell with the given address.
|
3050 |
|
3051 | **Kind**: instance method of [<code>Sheet</code>](#Sheet)
|
3052 | **Returns**: [<code>Sheet</code>](#Sheet) - The sheet.
|
3053 |
|
3054 | | Param | Type | Description |
|
3055 | | --- | --- | --- |
|
3056 | | address | <code>string</code> | The address of the hyperlinked cell. |
|
3057 | | hyperlink | <code>string</code> | The hyperlink to set or undefined to clear. |
|
3058 | | [internal] | <code>boolean</code> | The flag to force hyperlink to be internal. If true, then autodetect is skipped. |
|
3059 |
|
3060 | <a name="Sheet+hyperlink"></a>
|
3061 |
|
3062 | #### sheet.hyperlink(address, opts) ⇒ [<code>Sheet</code>](#Sheet)
|
3063 | Set the hyperlink on the cell with the given address and options.
|
3064 |
|
3065 | **Kind**: instance method of [<code>Sheet</code>](#Sheet)
|
3066 | **Returns**: [<code>Sheet</code>](#Sheet) - The sheet.
|
3067 |
|
3068 | | Param | Type | Description |
|
3069 | | --- | --- | --- |
|
3070 | | address | <code>string</code> | The address of the hyperlinked cell. |
|
3071 | | opts | <code>Object</code> \| [<code>Cell</code>](#Cell) | Options or Cell. If opts is a Cell then an internal hyperlink is added. |
|
3072 | | [opts.hyperlink] | <code>string</code> \| [<code>Cell</code>](#Cell) | The hyperlink to set, can be a Cell or an internal/external string. |
|
3073 | | [opts.tooltip] | <code>string</code> | Additional text to help the user understand more about the hyperlink. |
|
3074 | | [opts.email] | <code>string</code> | Email address, ignored if opts.hyperlink is set. |
|
3075 | | [opts.emailSubject] | <code>string</code> | Email subject, ignored if opts.hyperlink is set. |
|
3076 |
|
3077 | <a name="Sheet+printOptions"></a>
|
3078 |
|
3079 | #### sheet.printOptions(attributeName) ⇒ <code>boolean</code>
|
3080 | Get the print option given a valid print option attribute.
|
3081 |
|
3082 | **Kind**: instance method of [<code>Sheet</code>](#Sheet)
|
3083 |
|
3084 | | Param | Type | Description |
|
3085 | | --- | --- | --- |
|
3086 | | attributeName | <code>string</code> | Attribute name of the printOptions. gridLines - Used in conjunction with gridLinesSet. If both gridLines and gridlinesSet are true, then grid lines shall print. Otherwise, they shall not (i.e., one or both have false values). gridLinesSet - Used in conjunction with gridLines. If both gridLines and gridLinesSet are true, then grid lines shall print. Otherwise, they shall not (i.e., one or both have false values). headings - Print row and column headings. horizontalCentered - Center on page horizontally when printing. verticalCentered - Center on page vertically when printing. |
|
3087 |
|
3088 | <a name="Sheet+printOptions"></a>
|
3089 |
|
3090 | #### sheet.printOptions(attributeName, attributeEnabled) ⇒ [<code>Sheet</code>](#Sheet)
|
3091 | Set the print option given a valid print option attribute and a value.
|
3092 |
|
3093 | **Kind**: instance method of [<code>Sheet</code>](#Sheet)
|
3094 | **Returns**: [<code>Sheet</code>](#Sheet) - The sheet.
|
3095 |
|
3096 | | Param | Type | Description |
|
3097 | | --- | --- | --- |
|
3098 | | attributeName | <code>string</code> | Attribute name of the printOptions. See get print option for list of valid attributes. |
|
3099 | | attributeEnabled | <code>undefined</code> \| <code>boolean</code> | If `undefined` or `false` then the attribute is removed, otherwise the print option is enabled. |
|
3100 |
|
3101 | <a name="Sheet+printGridLines"></a>
|
3102 |
|
3103 | #### sheet.printGridLines() ⇒ <code>boolean</code>
|
3104 | Get the print option for the gridLines attribute value.
|
3105 |
|
3106 | **Kind**: instance method of [<code>Sheet</code>](#Sheet)
|
3107 | <a name="Sheet+printGridLines"></a>
|
3108 |
|
3109 | #### sheet.printGridLines(enabled) ⇒ [<code>Sheet</code>](#Sheet)
|
3110 | Set the print option for the gridLines attribute value.
|
3111 |
|
3112 | **Kind**: instance method of [<code>Sheet</code>](#Sheet)
|
3113 | **Returns**: [<code>Sheet</code>](#Sheet) - The sheet.
|
3114 |
|
3115 | | Param | Type | Description |
|
3116 | | --- | --- | --- |
|
3117 | | enabled | <code>undefined</code> \| <code>boolean</code> | If `undefined` or `false` then attribute is removed, otherwise gridLines is enabled. |
|
3118 |
|
3119 | <a name="Sheet+pageMargins"></a>
|
3120 |
|
3121 | #### sheet.pageMargins(attributeName) ⇒ <code>number</code>
|
3122 | Get the page margin given a valid attribute name.
|
3123 | If the value is not yet defined, then it will return the current preset value.
|
3124 |
|
3125 | **Kind**: instance method of [<code>Sheet</code>](#Sheet)
|
3126 | **Returns**: <code>number</code> - the attribute value.
|
3127 |
|
3128 | | Param | Type | Description |
|
3129 | | --- | --- | --- |
|
3130 | | attributeName | <code>string</code> | Attribute name of the pageMargins. left - Left Page Margin in inches. right - Right page margin in inches. top - Top Page Margin in inches. buttom - Bottom Page Margin in inches. footer - Footer Page Margin in inches. header - Header Page Margin in inches. |
|
3131 |
|
3132 | <a name="Sheet+pageMargins"></a>
|
3133 |
|
3134 | #### sheet.pageMargins(attributeName, attributeStringValue) ⇒ [<code>Sheet</code>](#Sheet)
|
3135 | Set the page margin (or override the preset) given an attribute name and a value.
|
3136 |
|
3137 | **Kind**: instance method of [<code>Sheet</code>](#Sheet)
|
3138 | **Returns**: [<code>Sheet</code>](#Sheet) - The sheet.
|
3139 |
|
3140 | | Param | Type | Description |
|
3141 | | --- | --- | --- |
|
3142 | | attributeName | <code>string</code> | Attribute name of the pageMargins. See get page margin for list of valid attributes. |
|
3143 | | attributeStringValue | <code>undefined</code> \| <code>number</code> \| <code>string</code> | If `undefined` then set back to preset value, otherwise, set the given attribute value. |
|
3144 |
|
3145 | <a name="Sheet+pageMarginsPreset"></a>
|
3146 |
|
3147 | #### sheet.pageMarginsPreset() ⇒ <code>string</code>
|
3148 | Page margins preset is a set of page margins associated with a name.
|
3149 | The page margin preset acts as a fallback when not explicitly defined by `Sheet.pageMargins`.
|
3150 | If a sheet already contains page margins, it attempts to auto-detect, otherwise they are defined as the template preset.
|
3151 | If no page margins exist, then the preset is undefined and will not be included in the output of `Sheet.toXmls`.
|
3152 | Available presets include: normal, wide, narrow, template.
|
3153 |
|
3154 | Get the page margins preset name. The registered name of a predefined set of attributes.
|
3155 |
|
3156 | **Kind**: instance method of [<code>Sheet</code>](#Sheet)
|
3157 | **Returns**: <code>string</code> - The preset name.
|
3158 | <a name="Sheet+pageMarginsPreset"></a>
|
3159 |
|
3160 | #### sheet.pageMarginsPreset(presetName) ⇒ [<code>Sheet</code>](#Sheet)
|
3161 | Set the page margins preset by name, clearing any existing/temporary attribute values.
|
3162 |
|
3163 | **Kind**: instance method of [<code>Sheet</code>](#Sheet)
|
3164 | **Returns**: [<code>Sheet</code>](#Sheet) - The sheet.
|
3165 |
|
3166 | | Param | Type | Description |
|
3167 | | --- | --- | --- |
|
3168 | | presetName | <code>undefined</code> \| <code>string</code> | The preset name. If `undefined`, page margins will not be included in the output of `Sheet.toXmls`. |
|
3169 |
|
3170 | <a name="Sheet+pageMarginsPreset"></a>
|
3171 |
|
3172 | #### sheet.pageMarginsPreset(presetName, presetAttributes) ⇒ [<code>Sheet</code>](#Sheet)
|
3173 | Set a new page margins preset by name and attributes object.
|
3174 |
|
3175 | **Kind**: instance method of [<code>Sheet</code>](#Sheet)
|
3176 | **Returns**: [<code>Sheet</code>](#Sheet) - The sheet.
|
3177 |
|
3178 | | Param | Type | Description |
|
3179 | | --- | --- | --- |
|
3180 | | presetName | <code>string</code> | The preset name. |
|
3181 | | presetAttributes | <code>object</code> | The preset attributes. |
|
3182 |
|
3183 | <a name="Sheet+panes"></a>
|
3184 |
|
3185 | #### sheet.panes() ⇒ [<code>PaneOptions</code>](#PaneOptions)
|
3186 | Gets sheet view pane options
|
3187 |
|
3188 | **Kind**: instance method of [<code>Sheet</code>](#Sheet)
|
3189 | **Returns**: [<code>PaneOptions</code>](#PaneOptions) - sheet view pane options
|
3190 | <a name="Sheet+panes"></a>
|
3191 |
|
3192 | #### sheet.panes(paneOptions) ⇒ [<code>Sheet</code>](#Sheet)
|
3193 | Sets sheet view pane options
|
3194 |
|
3195 | **Kind**: instance method of [<code>Sheet</code>](#Sheet)
|
3196 | **Returns**: [<code>Sheet</code>](#Sheet) - The sheet
|
3197 |
|
3198 | | Param | Type | Description |
|
3199 | | --- | --- | --- |
|
3200 | | paneOptions | [<code>PaneOptions</code>](#PaneOptions) \| <code>null</code> \| <code>undefined</code> | sheet view pane options |
|
3201 |
|
3202 | <a name="Sheet+freezePanes"></a>
|
3203 |
|
3204 | #### sheet.freezePanes(xSplit, ySplit) ⇒ [<code>Sheet</code>](#Sheet)
|
3205 | Freezes Panes for this sheet.
|
3206 |
|
3207 | **Kind**: instance method of [<code>Sheet</code>](#Sheet)
|
3208 | **Returns**: [<code>Sheet</code>](#Sheet) - The sheet
|
3209 |
|
3210 | | Param | Type | Description |
|
3211 | | --- | --- | --- |
|
3212 | | xSplit | <code>number</code> | the number of columns visible in the top pane. 0 (zero) if none. |
|
3213 | | ySplit | <code>number</code> | the number of rows visible in the left pane. 0 (zero) if none. |
|
3214 |
|
3215 | <a name="Sheet+freezePanes"></a>
|
3216 |
|
3217 | #### sheet.freezePanes(topLeftCell) ⇒ [<code>Sheet</code>](#Sheet)
|
3218 | freezes Panes for this sheet.
|
3219 |
|
3220 | **Kind**: instance method of [<code>Sheet</code>](#Sheet)
|
3221 | **Returns**: [<code>Sheet</code>](#Sheet) - The sheet
|
3222 |
|
3223 | | Param | Type | Description |
|
3224 | | --- | --- | --- |
|
3225 | | topLeftCell | <code>string</code> | Top Left Visible Cell. Location of the top left visible cell in the bottom right pane (when in Left-To-Right mode). |
|
3226 |
|
3227 | <a name="Sheet+splitPanes"></a>
|
3228 |
|
3229 | #### sheet.splitPanes(xSplit, ySplit) ⇒ [<code>Sheet</code>](#Sheet)
|
3230 | Splits Panes for this sheet.
|
3231 |
|
3232 | **Kind**: instance method of [<code>Sheet</code>](#Sheet)
|
3233 | **Returns**: [<code>Sheet</code>](#Sheet) - The sheet
|
3234 |
|
3235 | | Param | Type | Description |
|
3236 | | --- | --- | --- |
|
3237 | | xSplit | <code>number</code> | (Horizontal Split Position) Horizontal position of the split, in 1/20th of a point; 0 (zero) if none. |
|
3238 | | ySplit | <code>number</code> | (Vertical Split Position) VVertical position of the split, in 1/20th of a point; 0 (zero) if none. |
|
3239 |
|
3240 | <a name="Sheet+resetPanes"></a>
|
3241 |
|
3242 | #### sheet.resetPanes() ⇒ [<code>Sheet</code>](#Sheet)
|
3243 | resets to default sheet view panes.
|
3244 |
|
3245 | **Kind**: instance method of [<code>Sheet</code>](#Sheet)
|
3246 | **Returns**: [<code>Sheet</code>](#Sheet) - The sheet
|
3247 | <a name="Workbook"></a>
|
3248 |
|
3249 | ### Workbook
|
3250 | A workbook.
|
3251 |
|
3252 | **Kind**: global class
|
3253 |
|
3254 | * [Workbook](#Workbook)
|
3255 | * [.activeSheet()](#Workbook+activeSheet) ⇒ [<code>Sheet</code>](#Sheet)
|
3256 | * [.activeSheet(sheet)](#Workbook+activeSheet) ⇒ [<code>Workbook</code>](#Workbook)
|
3257 | * [.addSheet(name, [indexOrBeforeSheet])](#Workbook+addSheet) ⇒ [<code>Sheet</code>](#Sheet)
|
3258 | * [.definedName(name)](#Workbook+definedName) ⇒ <code>undefined</code> \| <code>string</code> \| [<code>Cell</code>](#Cell) \| [<code>Range</code>](#Range) \| [<code>Row</code>](#Row) \| [<code>Column</code>](#Column)
|
3259 | * [.definedName(name, refersTo)](#Workbook+definedName) ⇒ [<code>Workbook</code>](#Workbook)
|
3260 | * [.deleteSheet(sheet)](#Workbook+deleteSheet) ⇒ [<code>Workbook</code>](#Workbook)
|
3261 | * [.find(pattern, [replacement])](#Workbook+find) ⇒ <code>boolean</code>
|
3262 | * [.moveSheet(sheet, [indexOrBeforeSheet])](#Workbook+moveSheet) ⇒ [<code>Workbook</code>](#Workbook)
|
3263 | * [.outputAsync([type])](#Workbook+outputAsync) ⇒ <code>Promise.<(string\|Uint8Array\|ArrayBuffer\|Blob\|Buffer)></code>
|
3264 | * [.outputAsync([opts])](#Workbook+outputAsync) ⇒ <code>Promise.<(string\|Uint8Array\|ArrayBuffer\|Blob\|Buffer)></code>
|
3265 | * [.sheet(sheetNameOrIndex)](#Workbook+sheet) ⇒ [<code>Sheet</code>](#Sheet) \| <code>undefined</code>
|
3266 | * [.sheets()](#Workbook+sheets) ⇒ [<code>Array.<Sheet></code>](#Sheet)
|
3267 | * [.property(name)](#Workbook+property) ⇒ <code>\*</code>
|
3268 | * [.property(names)](#Workbook+property) ⇒ <code>object.<string, \*></code>
|
3269 | * [.property(name, value)](#Workbook+property) ⇒ [<code>Workbook</code>](#Workbook)
|
3270 | * [.property(properties)](#Workbook+property) ⇒ [<code>Workbook</code>](#Workbook)
|
3271 | * [.properties()](#Workbook+properties) ⇒ <code>CoreProperties</code>
|
3272 | * [.toFileAsync(path, [opts])](#Workbook+toFileAsync) ⇒ <code>Promise.<undefined></code>
|
3273 | * [.cloneSheet(from, name, [indexOrBeforeSheet])](#Workbook+cloneSheet) ⇒ [<code>Sheet</code>](#Sheet)
|
3274 |
|
3275 | <a name="Workbook+activeSheet"></a>
|
3276 |
|
3277 | #### workbook.activeSheet() ⇒ [<code>Sheet</code>](#Sheet)
|
3278 | Get the active sheet in the workbook.
|
3279 |
|
3280 | **Kind**: instance method of [<code>Workbook</code>](#Workbook)
|
3281 | **Returns**: [<code>Sheet</code>](#Sheet) - The active sheet.
|
3282 | <a name="Workbook+activeSheet"></a>
|
3283 |
|
3284 | #### workbook.activeSheet(sheet) ⇒ [<code>Workbook</code>](#Workbook)
|
3285 | Set the active sheet in the workbook.
|
3286 |
|
3287 | **Kind**: instance method of [<code>Workbook</code>](#Workbook)
|
3288 | **Returns**: [<code>Workbook</code>](#Workbook) - The workbook.
|
3289 |
|
3290 | | Param | Type | Description |
|
3291 | | --- | --- | --- |
|
3292 | | sheet | [<code>Sheet</code>](#Sheet) \| <code>string</code> \| <code>number</code> | The sheet or name of sheet or index of sheet to activate. The sheet must not be hidden. |
|
3293 |
|
3294 | <a name="Workbook+addSheet"></a>
|
3295 |
|
3296 | #### workbook.addSheet(name, [indexOrBeforeSheet]) ⇒ [<code>Sheet</code>](#Sheet)
|
3297 | Add a new sheet to the workbook.
|
3298 |
|
3299 | **Kind**: instance method of [<code>Workbook</code>](#Workbook)
|
3300 | **Returns**: [<code>Sheet</code>](#Sheet) - The new sheet.
|
3301 |
|
3302 | | Param | Type | Description |
|
3303 | | --- | --- | --- |
|
3304 | | name | <code>string</code> | The name of the sheet. Must be unique, less than 31 characters, and may not contain the following characters: \ / * [ ] : ? |
|
3305 | | [indexOrBeforeSheet] | <code>number</code> \| <code>string</code> \| [<code>Sheet</code>](#Sheet) | The index to move the sheet to or the sheet (or name of sheet) to move this sheet before. Omit this argument to move to the end of the workbook. |
|
3306 |
|
3307 | <a name="Workbook+definedName"></a>
|
3308 |
|
3309 | #### workbook.definedName(name) ⇒ <code>undefined</code> \| <code>string</code> \| [<code>Cell</code>](#Cell) \| [<code>Range</code>](#Range) \| [<code>Row</code>](#Row) \| [<code>Column</code>](#Column)
|
3310 | Gets a defined name scoped to the workbook.
|
3311 |
|
3312 | **Kind**: instance method of [<code>Workbook</code>](#Workbook)
|
3313 | **Returns**: <code>undefined</code> \| <code>string</code> \| [<code>Cell</code>](#Cell) \| [<code>Range</code>](#Range) \| [<code>Row</code>](#Row) \| [<code>Column</code>](#Column) - What the defined name refers to or undefined if not found. Will return the string formula if not a Row, Column, Cell, or Range.
|
3314 |
|
3315 | | Param | Type | Description |
|
3316 | | --- | --- | --- |
|
3317 | | name | <code>string</code> | The defined name. |
|
3318 |
|
3319 | <a name="Workbook+definedName"></a>
|
3320 |
|
3321 | #### workbook.definedName(name, refersTo) ⇒ [<code>Workbook</code>](#Workbook)
|
3322 | Set a defined name scoped to the workbook.
|
3323 |
|
3324 | **Kind**: instance method of [<code>Workbook</code>](#Workbook)
|
3325 | **Returns**: [<code>Workbook</code>](#Workbook) - The workbook.
|
3326 |
|
3327 | | Param | Type | Description |
|
3328 | | --- | --- | --- |
|
3329 | | name | <code>string</code> | The defined name. |
|
3330 | | refersTo | <code>string</code> \| [<code>Cell</code>](#Cell) \| [<code>Range</code>](#Range) \| [<code>Row</code>](#Row) \| [<code>Column</code>](#Column) | What the name refers to. |
|
3331 |
|
3332 | <a name="Workbook+deleteSheet"></a>
|
3333 |
|
3334 | #### workbook.deleteSheet(sheet) ⇒ [<code>Workbook</code>](#Workbook)
|
3335 | Delete a sheet from the workbook.
|
3336 |
|
3337 | **Kind**: instance method of [<code>Workbook</code>](#Workbook)
|
3338 | **Returns**: [<code>Workbook</code>](#Workbook) - The workbook.
|
3339 |
|
3340 | | Param | Type | Description |
|
3341 | | --- | --- | --- |
|
3342 | | sheet | [<code>Sheet</code>](#Sheet) \| <code>string</code> \| <code>number</code> | The sheet or name of sheet or index of sheet to move. |
|
3343 |
|
3344 | <a name="Workbook+find"></a>
|
3345 |
|
3346 | #### workbook.find(pattern, [replacement]) ⇒ <code>boolean</code>
|
3347 | Find the given pattern in the workbook and optionally replace it.
|
3348 |
|
3349 | **Kind**: instance method of [<code>Workbook</code>](#Workbook)
|
3350 | **Returns**: <code>boolean</code> - A flag indicating if the pattern was found.
|
3351 |
|
3352 | | Param | Type | Description |
|
3353 | | --- | --- | --- |
|
3354 | | pattern | <code>string</code> \| <code>RegExp</code> | The pattern to look for. Providing a string will result in a case-insensitive substring search. Use a RegExp for more sophisticated searches. |
|
3355 | | [replacement] | <code>string</code> \| <code>function</code> | The text to replace or a String.replace callback function. If pattern is a string, all occurrences of the pattern in each cell will be replaced. |
|
3356 |
|
3357 | <a name="Workbook+moveSheet"></a>
|
3358 |
|
3359 | #### workbook.moveSheet(sheet, [indexOrBeforeSheet]) ⇒ [<code>Workbook</code>](#Workbook)
|
3360 | Move a sheet to a new position.
|
3361 |
|
3362 | **Kind**: instance method of [<code>Workbook</code>](#Workbook)
|
3363 | **Returns**: [<code>Workbook</code>](#Workbook) - The workbook.
|
3364 |
|
3365 | | Param | Type | Description |
|
3366 | | --- | --- | --- |
|
3367 | | sheet | [<code>Sheet</code>](#Sheet) \| <code>string</code> \| <code>number</code> | The sheet or name of sheet or index of sheet to move. |
|
3368 | | [indexOrBeforeSheet] | <code>number</code> \| <code>string</code> \| [<code>Sheet</code>](#Sheet) | The index to move the sheet to or the sheet (or name of sheet) to move this sheet before. Omit this argument to move to the end of the workbook. |
|
3369 |
|
3370 | <a name="Workbook+outputAsync"></a>
|
3371 |
|
3372 | #### workbook.outputAsync([type]) ⇒ <code>Promise.<(string\|Uint8Array\|ArrayBuffer\|Blob\|Buffer)></code>
|
3373 | Generates the workbook output.
|
3374 |
|
3375 | **Kind**: instance method of [<code>Workbook</code>](#Workbook)
|
3376 | **Returns**: <code>Promise.<(string\|Uint8Array\|ArrayBuffer\|Blob\|Buffer)></code> - The data.
|
3377 |
|
3378 | | Param | Type | Description |
|
3379 | | --- | --- | --- |
|
3380 | | [type] | <code>string</code> | The type of the data to return: base64, binarystring, uint8array, arraybuffer, blob, nodebuffer. Defaults to 'nodebuffer' in Node.js and 'blob' in browsers. |
|
3381 |
|
3382 | <a name="Workbook+outputAsync"></a>
|
3383 |
|
3384 | #### workbook.outputAsync([opts]) ⇒ <code>Promise.<(string\|Uint8Array\|ArrayBuffer\|Blob\|Buffer)></code>
|
3385 | Generates the workbook output.
|
3386 |
|
3387 | **Kind**: instance method of [<code>Workbook</code>](#Workbook)
|
3388 | **Returns**: <code>Promise.<(string\|Uint8Array\|ArrayBuffer\|Blob\|Buffer)></code> - The data.
|
3389 |
|
3390 | | Param | Type | Description |
|
3391 | | --- | --- | --- |
|
3392 | | [opts] | <code>Object</code> | Options |
|
3393 | | [opts.type] | <code>string</code> | The type of the data to return: base64, binarystring, uint8array, arraybuffer, blob, nodebuffer. Defaults to 'nodebuffer' in Node.js and 'blob' in browsers. |
|
3394 | | [opts.password] | <code>string</code> | The password to use to encrypt the workbook. |
|
3395 |
|
3396 | <a name="Workbook+sheet"></a>
|
3397 |
|
3398 | #### workbook.sheet(sheetNameOrIndex) ⇒ [<code>Sheet</code>](#Sheet) \| <code>undefined</code>
|
3399 | Gets the sheet with the provided name or index (0-based).
|
3400 |
|
3401 | **Kind**: instance method of [<code>Workbook</code>](#Workbook)
|
3402 | **Returns**: [<code>Sheet</code>](#Sheet) \| <code>undefined</code> - The sheet or undefined if not found.
|
3403 |
|
3404 | | Param | Type | Description |
|
3405 | | --- | --- | --- |
|
3406 | | sheetNameOrIndex | <code>string</code> \| <code>number</code> | The sheet name or index. |
|
3407 |
|
3408 | <a name="Workbook+sheets"></a>
|
3409 |
|
3410 | #### workbook.sheets() ⇒ [<code>Array.<Sheet></code>](#Sheet)
|
3411 | Get an array of all the sheets in the workbook.
|
3412 |
|
3413 | **Kind**: instance method of [<code>Workbook</code>](#Workbook)
|
3414 | **Returns**: [<code>Array.<Sheet></code>](#Sheet) - The sheets.
|
3415 | <a name="Workbook+property"></a>
|
3416 |
|
3417 | #### workbook.property(name) ⇒ <code>\*</code>
|
3418 | Gets an individual property.
|
3419 |
|
3420 | **Kind**: instance method of [<code>Workbook</code>](#Workbook)
|
3421 | **Returns**: <code>\*</code> - The property.
|
3422 |
|
3423 | | Param | Type | Description |
|
3424 | | --- | --- | --- |
|
3425 | | name | <code>string</code> | The name of the property. |
|
3426 |
|
3427 | <a name="Workbook+property"></a>
|
3428 |
|
3429 | #### workbook.property(names) ⇒ <code>object.<string, \*></code>
|
3430 | Gets multiple properties.
|
3431 |
|
3432 | **Kind**: instance method of [<code>Workbook</code>](#Workbook)
|
3433 | **Returns**: <code>object.<string, \*></code> - Object whose keys are the property names and values are the properties.
|
3434 |
|
3435 | | Param | Type | Description |
|
3436 | | --- | --- | --- |
|
3437 | | names | <code>Array.<string></code> | The names of the properties. |
|
3438 |
|
3439 | <a name="Workbook+property"></a>
|
3440 |
|
3441 | #### workbook.property(name, value) ⇒ [<code>Workbook</code>](#Workbook)
|
3442 | Sets an individual property.
|
3443 |
|
3444 | **Kind**: instance method of [<code>Workbook</code>](#Workbook)
|
3445 | **Returns**: [<code>Workbook</code>](#Workbook) - The workbook.
|
3446 |
|
3447 | | Param | Type | Description |
|
3448 | | --- | --- | --- |
|
3449 | | name | <code>string</code> | The name of the property. |
|
3450 | | value | <code>\*</code> | The value to set. |
|
3451 |
|
3452 | <a name="Workbook+property"></a>
|
3453 |
|
3454 | #### workbook.property(properties) ⇒ [<code>Workbook</code>](#Workbook)
|
3455 | Sets multiple properties.
|
3456 |
|
3457 | **Kind**: instance method of [<code>Workbook</code>](#Workbook)
|
3458 | **Returns**: [<code>Workbook</code>](#Workbook) - The workbook.
|
3459 |
|
3460 | | Param | Type | Description |
|
3461 | | --- | --- | --- |
|
3462 | | properties | <code>object.<string, \*></code> | Object whose keys are the property names and values are the values to set. |
|
3463 |
|
3464 | <a name="Workbook+properties"></a>
|
3465 |
|
3466 | #### workbook.properties() ⇒ <code>CoreProperties</code>
|
3467 | Get access to core properties object
|
3468 |
|
3469 | **Kind**: instance method of [<code>Workbook</code>](#Workbook)
|
3470 | **Returns**: <code>CoreProperties</code> - The core properties.
|
3471 | <a name="Workbook+toFileAsync"></a>
|
3472 |
|
3473 | #### workbook.toFileAsync(path, [opts]) ⇒ <code>Promise.<undefined></code>
|
3474 | Write the workbook to file. (Not supported in browsers.)
|
3475 |
|
3476 | **Kind**: instance method of [<code>Workbook</code>](#Workbook)
|
3477 | **Returns**: <code>Promise.<undefined></code> - A promise.
|
3478 |
|
3479 | | Param | Type | Description |
|
3480 | | --- | --- | --- |
|
3481 | | path | <code>string</code> | The path of the file to write. |
|
3482 | | [opts] | <code>Object</code> | Options |
|
3483 | | [opts.password] | <code>string</code> | The password to encrypt the workbook. |
|
3484 |
|
3485 | <a name="Workbook+cloneSheet"></a>
|
3486 |
|
3487 | #### workbook.cloneSheet(from, name, [indexOrBeforeSheet]) ⇒ [<code>Sheet</code>](#Sheet)
|
3488 | Add a new sheet to the workbook.
|
3489 |
|
3490 | **WARN:** this function has limits: if you clone a sheet with some images or other things link outside the Sheet object, these things in the cloned sheet will be locked when you open in MS Excel app.
|
3491 |
|
3492 | **Kind**: instance method of [<code>Workbook</code>](#Workbook)
|
3493 | **Returns**: [<code>Sheet</code>](#Sheet) - The new sheet.
|
3494 |
|
3495 | | Param | Type | Description |
|
3496 | | --- | --- | --- |
|
3497 | | from | [<code>Sheet</code>](#Sheet) | The sheet to be cloned. |
|
3498 | | name | <code>string</code> | The name of the new sheet. Must be unique, less than 31 characters, and may not contain the following characters: \ / * [ ] : ? |
|
3499 | | [indexOrBeforeSheet] | <code>number</code> \| <code>string</code> \| [<code>Sheet</code>](#Sheet) | The index to move the sheet to or the sheet (or name of sheet) to move this sheet before. Omit this argument to move to the end of the workbook. |
|
3500 |
|
3501 | <a name="XlsxPopulate"></a>
|
3502 |
|
3503 | ### XlsxPopulate : <code>object</code>
|
3504 | **Kind**: global namespace
|
3505 |
|
3506 | * [XlsxPopulate](#XlsxPopulate) : <code>object</code>
|
3507 | * [.Promise](#XlsxPopulate.Promise) : <code>Promise</code>
|
3508 | * [.MIME_TYPE](#XlsxPopulate.MIME_TYPE) : <code>string</code>
|
3509 | * [.FormulaError](#XlsxPopulate.FormulaError) : [<code>FormulaError</code>](#FormulaError)
|
3510 | * [.RichText](#XlsxPopulate.RichText) : [<code>RichText</code>](#RichText)
|
3511 | * [.dateToNumber(date)](#XlsxPopulate.dateToNumber) ⇒ <code>number</code>
|
3512 | * [.fromBlankAsync()](#XlsxPopulate.fromBlankAsync) ⇒ [<code>Promise.<Workbook></code>](#Workbook)
|
3513 | * [.fromDataAsync(data, [opts])](#XlsxPopulate.fromDataAsync) ⇒ [<code>Promise.<Workbook></code>](#Workbook)
|
3514 | * [.fromFileAsync(path, [opts])](#XlsxPopulate.fromFileAsync) ⇒ [<code>Promise.<Workbook></code>](#Workbook)
|
3515 | * [.numberToDate(number)](#XlsxPopulate.numberToDate) ⇒ <code>Date</code>
|
3516 |
|
3517 | <a name="XlsxPopulate.Promise"></a>
|
3518 |
|
3519 | #### XlsxPopulate.Promise : <code>Promise</code>
|
3520 | The Promise library.
|
3521 |
|
3522 | **Kind**: static property of [<code>XlsxPopulate</code>](#XlsxPopulate)
|
3523 | <a name="XlsxPopulate.MIME_TYPE"></a>
|
3524 |
|
3525 | #### XlsxPopulate.MIME\_TYPE : <code>string</code>
|
3526 | The XLSX mime type.
|
3527 |
|
3528 | **Kind**: static property of [<code>XlsxPopulate</code>](#XlsxPopulate)
|
3529 | <a name="XlsxPopulate.FormulaError"></a>
|
3530 |
|
3531 | #### XlsxPopulate.FormulaError : [<code>FormulaError</code>](#FormulaError)
|
3532 | Formula error class.
|
3533 |
|
3534 | **Kind**: static property of [<code>XlsxPopulate</code>](#XlsxPopulate)
|
3535 | <a name="XlsxPopulate.RichText"></a>
|
3536 |
|
3537 | #### XlsxPopulate.RichText : [<code>RichText</code>](#RichText)
|
3538 | RichTexts class
|
3539 |
|
3540 | **Kind**: static property of [<code>XlsxPopulate</code>](#XlsxPopulate)
|
3541 | <a name="XlsxPopulate.dateToNumber"></a>
|
3542 |
|
3543 | #### XlsxPopulate.dateToNumber(date) ⇒ <code>number</code>
|
3544 | Convert a date to a number for Excel.
|
3545 |
|
3546 | **Kind**: static method of [<code>XlsxPopulate</code>](#XlsxPopulate)
|
3547 | **Returns**: <code>number</code> - The number.
|
3548 |
|
3549 | | Param | Type | Description |
|
3550 | | --- | --- | --- |
|
3551 | | date | <code>Date</code> | The date. |
|
3552 |
|
3553 | <a name="XlsxPopulate.fromBlankAsync"></a>
|
3554 |
|
3555 | #### XlsxPopulate.fromBlankAsync() ⇒ [<code>Promise.<Workbook></code>](#Workbook)
|
3556 | Create a new blank workbook.
|
3557 |
|
3558 | **Kind**: static method of [<code>XlsxPopulate</code>](#XlsxPopulate)
|
3559 | **Returns**: [<code>Promise.<Workbook></code>](#Workbook) - The workbook.
|
3560 | <a name="XlsxPopulate.fromDataAsync"></a>
|
3561 |
|
3562 | #### XlsxPopulate.fromDataAsync(data, [opts]) ⇒ [<code>Promise.<Workbook></code>](#Workbook)
|
3563 | Loads a workbook from a data object. (Supports any supported [JSZip data types](https://stuk.github.io/jszip/documentation/api_jszip/load_async.html).)
|
3564 |
|
3565 | **Kind**: static method of [<code>XlsxPopulate</code>](#XlsxPopulate)
|
3566 | **Returns**: [<code>Promise.<Workbook></code>](#Workbook) - The workbook.
|
3567 |
|
3568 | | Param | Type | Description |
|
3569 | | --- | --- | --- |
|
3570 | | data | <code>string</code> \| <code>Array.<number></code> \| <code>ArrayBuffer</code> \| <code>Uint8Array</code> \| <code>Buffer</code> \| <code>Blob</code> \| <code>Promise.<\*></code> | The data to load. |
|
3571 | | [opts] | <code>Object</code> | Options |
|
3572 | | [opts.password] | <code>string</code> | The password to decrypt the workbook. |
|
3573 |
|
3574 | <a name="XlsxPopulate.fromFileAsync"></a>
|
3575 |
|
3576 | #### XlsxPopulate.fromFileAsync(path, [opts]) ⇒ [<code>Promise.<Workbook></code>](#Workbook)
|
3577 | Loads a workbook from file.
|
3578 |
|
3579 | **Kind**: static method of [<code>XlsxPopulate</code>](#XlsxPopulate)
|
3580 | **Returns**: [<code>Promise.<Workbook></code>](#Workbook) - The workbook.
|
3581 |
|
3582 | | Param | Type | Description |
|
3583 | | --- | --- | --- |
|
3584 | | path | <code>string</code> | The path to the workbook. |
|
3585 | | [opts] | <code>Object</code> | Options |
|
3586 | | [opts.password] | <code>string</code> | The password to decrypt the workbook. |
|
3587 |
|
3588 | <a name="XlsxPopulate.numberToDate"></a>
|
3589 |
|
3590 | #### XlsxPopulate.numberToDate(number) ⇒ <code>Date</code>
|
3591 | Convert an Excel number to a date.
|
3592 |
|
3593 | **Kind**: static method of [<code>XlsxPopulate</code>](#XlsxPopulate)
|
3594 | **Returns**: <code>Date</code> - The date.
|
3595 |
|
3596 | | Param | Type | Description |
|
3597 | | --- | --- | --- |
|
3598 | | number | <code>number</code> | The number. |
|
3599 |
|
3600 | <a name="_"></a>
|
3601 |
|
3602 | ### \_
|
3603 | OOXML uses the CFB file format with Agile Encryption. The details of the encryption are here:
|
3604 | https://msdn.microsoft.com/en-us/library/dd950165(v=office.12).aspx
|
3605 |
|
3606 | Helpful guidance also take from this Github project:
|
3607 | https://github.com/nolze/ms-offcrypto-tool
|
3608 |
|
3609 | **Kind**: global constant
|
3610 | <a name="PaneOptions"></a>
|
3611 |
|
3612 | ### PaneOptions : <code>Object</code>
|
3613 | https://docs.microsoft.com/en-us/dotnet/api/documentformat.openxml.spreadsheet.pane?view=openxml-2.8.1
|
3614 |
|
3615 | **Kind**: global typedef
|
3616 | **Properties**
|
3617 |
|
3618 | | Name | Type | Default | Description |
|
3619 | | --- | --- | --- | --- |
|
3620 | | activePane | <code>string</code> | <code>"bottomRight"</code> | Active Pane. The pane that is active. |
|
3621 | | state | <code>string</code> | | Split State. Indicates whether the pane has horizontal / vertical splits, and whether those splits are frozen. |
|
3622 | | topLeftCell | <code>string</code> | | Top Left Visible Cell. Location of the top left visible cell in the bottom right pane (when in Left-To-Right mode). |
|
3623 | | xSplit | <code>number</code> | | (Horizontal Split Position) Horizontal position of the split, in 1/20th of a point; 0 (zero) if none. If the pane is frozen, this value indicates the number of columns visible in the top pane. |
|
3624 | | ySplit | <code>number</code> | | (Vertical Split Position) Vertical position of the split, in 1/20th of a point; 0 (zero) if none. If the pane is frozen, this value indicates the number of rows visible in the left pane. |
|
3625 |
|
3626 |
|