Expanding Cells
By default, a cell is displayed in a single row and column.
However, you can configure a cell to occupy more than one row or column.
Spanning across Columns
To expand a cell across two or more columns, set the colSpan
option. As a result, all cells will follow shift to the right with the same number of columns as defined by the colSpan
.
<script>
var workbook = new kendo.ooxml.Workbook({
sheets: [
{
rows: [
{
cells: [
{ value: "A1, B1 and C1", colSpan: 3 }, { value: "D1" }
]
}
]
}
]
});
kendo.saveAs({
dataURI: workbook.toDataURL(),
fileName: "Test.xlsx"
});
</script>
Spanning across Rows
To expand a cell across two or more rows, set the rowSpan
option.
<script>
var workbook = new kendo.ooxml.Workbook({
sheets: [
{
rows: [
{
cells: [
{ value: "A1 and A2", rowSpan: 2 }, { value: "B1" }
]
},
{
cells: [
{ value: "B2" }
]
}
]
}
]
});
kendo.saveAs({
dataURI: workbook.toDataURL(),
fileName: "Test.xlsx"
});
</script>
Spanning across Rows and Columns
To span a cell across two or more rows and columns simultaneously, use both the colSpan
and rowSpan
options.
<script>
var workbook = new kendo.ooxml.Workbook({
sheets: [
{
rows: [
{
cells: [
{ value: "A1, B1, A2 and B2", rowSpan: 2, colSpan: 2 }
]
}
]
}
]
});
kendo.saveAs({
dataURI: workbook.toDataURL(),
fileName: "Test.xlsx"
});
</script>