MCPcopy
hub / github.com/exceljs/exceljs / load

Method load

lib/doc/table.js:236–273  ·  view source on GitHub ↗
(worksheet)

Source from the content-addressed store, hash-verified

234 }
235
236 load(worksheet) {
237 // where the table will read necessary features from a loaded sheet
238 const {table} = this;
239 const {row, col} = table.tl;
240 let count = 0;
241 if (table.headerRow) {
242 const r = worksheet.getRow(row + count++);
243 table.columns.forEach((column, j) => {
244 const cell = r.getCell(col + j);
245 cell.value = column.name;
246 });
247 }
248 table.rows.forEach(data => {
249 const r = worksheet.getRow(row + count++);
250 data.forEach((value, j) => {
251 const cell = r.getCell(col + j);
252 cell.value = value;
253 });
254 });
255
256 if (table.totalsRow) {
257 const r = worksheet.getRow(row + count++);
258 table.columns.forEach((column, j) => {
259 const cell = r.getCell(col + j);
260 if (j === 0) {
261 cell.value = column.totalsRowLabel;
262 } else {
263 const formula = this.getFormula(column);
264 if (formula) {
265 cell.value = {
266 formula: column.totalsRowFormula,
267 result: column.totalsRowResult,
268 };
269 }
270 }
271 });
272 }
273 }
274
275 get model() {
276 return this.table;

Callers

nothing calls this directly

Calls 4

getFormulaMethod · 0.95
getRowMethod · 0.65
forEachMethod · 0.65
getCellMethod · 0.65

Tested by

no test coverage detected