| 134 | } |
| 135 | |
| 136 | addWorksheet(name, options) { |
| 137 | // it's possible to add a worksheet with different than default |
| 138 | // shared string handling |
| 139 | // in fact, it's even possible to switch it mid-sheet |
| 140 | options = options || {}; |
| 141 | const useSharedStrings = |
| 142 | options.useSharedStrings !== undefined ? options.useSharedStrings : this.useSharedStrings; |
| 143 | |
| 144 | if (options.tabColor) { |
| 145 | // eslint-disable-next-line no-console |
| 146 | console.trace('tabColor option has moved to { properties: tabColor: {...} }'); |
| 147 | options.properties = Object.assign( |
| 148 | { |
| 149 | tabColor: options.tabColor, |
| 150 | }, |
| 151 | options.properties |
| 152 | ); |
| 153 | } |
| 154 | |
| 155 | const id = this.nextId; |
| 156 | name = name || `sheet${id}`; |
| 157 | |
| 158 | const worksheet = new WorksheetWriter({ |
| 159 | id, |
| 160 | name, |
| 161 | workbook: this, |
| 162 | useSharedStrings, |
| 163 | properties: options.properties, |
| 164 | state: options.state, |
| 165 | pageSetup: options.pageSetup, |
| 166 | views: options.views, |
| 167 | autoFilter: options.autoFilter, |
| 168 | headerFooter: options.headerFooter, |
| 169 | }); |
| 170 | |
| 171 | this._worksheets[id] = worksheet; |
| 172 | return worksheet; |
| 173 | } |
| 174 | |
| 175 | getWorksheet(id) { |
| 176 | if (id === undefined) { |