Home Reference Source
import {Sheet} from 'better-xlsx/src/sheet.js'
public class | source

Sheet

Sheet of the xlsx file.

import { File } from 'better-xlsx';
const file = new File();
const sheet = file.addSheet('Sheet-1');
const row = sheet.addRow();
const cell = row.addCell();

Method Summary

Public Methods
public

addRow(): Row

Create a Row and add it into the Sheet.

public

cell(row: Number, col: Number): Cell

Get Cell of the sheet with (row, col) and create cell when out of range.

public

col(idx: Number): Col

Get Col of the sheet with index and create cols when index > maxCol.

public

row(idx: Number): Row

Get Row of the sheet with index and create rows when index > maxRow.

public

setColWidth(startcol: Number, endcol: Number, width: Number)

Set columns width from startcol to endcol.

Public Methods

public addRow(): Row source

Create a Row and add it into the Sheet.

Return:

Row

public cell(row: Number, col: Number): Cell source

Get Cell of the sheet with (row, col) and create cell when out of range.

Params:

NameTypeAttributeDescription
row Number
col Number

Return:

Cell

public col(idx: Number): Col source

Get Col of the sheet with index and create cols when index > maxCol.

Params:

NameTypeAttributeDescription
idx Number

Index of the Col [from 0].

Return:

Col

public row(idx: Number): Row source

Get Row of the sheet with index and create rows when index > maxRow.

Params:

NameTypeAttributeDescription
idx Number

Index of the Row [from 0].

Return:

Row

public setColWidth(startcol: Number, endcol: Number, width: Number) source

Set columns width from startcol to endcol.

Params:

NameTypeAttributeDescription
startcol Number
endcol Number
width Number