[]
SpreadJS allows you to overwrite cells when spilled in a ReportSheet. To set the spill mode in the template sheet, configure the spillMode
property in the setTemplateCell
method.
There are two different types of spill modes available.
Insert: This is the default mode. This mode will insert rows and columns when rendering the report.
Overwrite: This mode will not insert new rows and columns when rendering the report. It keeps the report layout and size as same as the template.
Notes:
When using the Overwrite spill mode, the template cell type must be set to List.
Overwrite spill mode is effective only on un-merged cells.
You can use the following code sample to set the spill mode of the cell.
const columns = ['Id', 'Name'];
columns.forEach((columnName, i) => {
templateSheet.setValue(4, 3 + i, columnName.toUpperCase());
templateSheet.setTemplateCell(5, 3 + i, {
type: 'List',
binding: `Products[${columnName}]`,
// Set the Spill Mode : "Overwrite" || "Insert"
spillMode: 'Overwrite'
});
});