Represents the Workbook.
number
Specifies the active sheet index in the workbook.
<template>
<!-- Set 'Car Stock Report' sheet as active sheet. -->
<ejs-spreadsheet :activeSheetIndex="1">
<e-sheets>
<e-sheet name="Car Sales Report"> </e-sheet>
<e-sheet name="Car Stock Report"> </e-sheet>
</e-sheets>
</ejs-spreadsheet>
</template>
<script>
import Vue from "vue";
import { SpreadsheetPlugin } from "@syncfusion/ej2-vue-spreadsheet";
Vue.use(SpreadsheetPlugin);
export default Vue.extend({});
</script>
Defaults to 0
boolean
It allows to enable/disable AutoFill functionalities.
Defaults to true
boolean
It allows you to apply styles (font size, font weight, font family, fill color, and more) to the spreadsheet cells.
Defaults to true
boolean
It allows you to insert the chart in a spreadsheet.
Defaults to true
boolean
It allows you to apply conditional formatting to the sheet.
Defaults to true
boolean
It allows you to apply data validation to the spreadsheet cells.
Defaults to true
boolean
It allows you to delete rows, columns, and sheets from a spreadsheet.
Defaults to true
boolean
It allows you to add new data or update existing cell data. If it is false, it will act as read only mode.
Defaults to true
boolean
It allows to enable/disable filter and its functionalities.
Defaults to true
boolean
It allows to enable/disable find and replace with its functionalities.
Defaults to true
boolean
It allows to enable/disable freeze pane functionality in spreadsheet.
Defaults to true
boolean
It allows to enable/disable Hyperlink and its functionalities.
Defaults to true
boolean
It allows you to insert the image in a spreadsheet.
Defaults to true
boolean
It allows you to insert rows, columns, and sheets into the spreadsheet.
Defaults to true
boolean
It allows you to merge the range of cells.
Defaults to true
boolean
It allows formatting a raw number into different types of formats (number, currency, accounting, percentage, short date, long date, time, fraction, scientific, and text) with built-in format codes.
Defaults to true
boolean
It allows you to open an Excel file (.xlsx, .xls, and .csv) in Spreadsheet.
Defaults to true
boolean
Enables or disables the printing functionality in the spreadsheet.
Defaults to true
boolean
It allows you to save Spreadsheet with all data as Excel file (.xlsx, .xls, and .csv).
Defaults to true
boolean
It allows to enable/disable sort and its functionalities.
Defaults to true
Configures the auto fill settings.
The autoFillSettings fillType
property has FOUR types and it is described below:
<template>
<ejs-spreadsheet :autoFill="true" :autoFillSettings="{ autoFillSettings }"></ejs-spreadsheet>
</template>
<script>
import Vue from "vue";
import { SpreadsheetPlugin } from "@syncfusion/ej2-vue-spreadsheet";
Vue.use(SpreadsheetPlugin);
export default Vue.extend({
data: () => {
return {
// Configure the autofill settings.
autoFillSettings: { fillType: "CopyCells", showFillOptions: true },
};
},
});
</script>
The
allowAutoFill
property should betrue
.
Defaults to { fillType: ‘FillSeries’, showFillOptions: true }
Specifies the mode of calculation within the spreadsheet.
Setting the calculation mode to Manual
can enhance performance,
particularly when working with multiple sheets at the same time.
Automatic
: Calculations are performed automatically whenever a cell value changes.Manual
: Calculations are performed only when explicitly triggered, improving performance
when loading or working with large spreadsheets.Defaults to ‘Automatic’
Specifies the cell style options.
<template>
<ejs-spreadsheet :cellStyle="cellStyle"></ejs-spreadsheet>
</template>
<script>
import Vue from "vue";
import { SpreadsheetPlugin } from "@syncfusion/ej2-vue-spreadsheet";
Vue.use(SpreadsheetPlugin);
export default Vue.extend({
data: () => {
return {
// Specifies the cellStyle settings.
cellStyle: {
fontWeight: "bold",
fontSize: "12pt",
fontStyle: "italic",
textIndent: "2pt",
backgroundColor: "#4b5366",
color: "#ffffff",
},
};
},
});
</script>
Defaults to {}
Specifies the name of a range and uses it in a formula for calculation.
<template>
<ejs-spreadsheet :definedNames="definedNames"></ejs-spreadsheet>
</template>
<script>
import Vue from "vue";
import { SpreadsheetPlugin } from "@syncfusion/ej2-vue-spreadsheet";
Vue.use(SpreadsheetPlugin);
export default Vue.extend({
data: () => {
return {
// Set the specified cell range's name to 'Group1'.
definedNames: [{ name: "Group1", refersTo: "Sheet1!A1:B5" }],
};
},
});
</script>
Defaults to []
boolean
Enables or disables the ability to add or show notes in the Spreadsheet. If the property is set to false, the Spreadsheet will not add notes in the cells and the notes in the existing cells will not be visible.
Defaults to true
boolean
Enable or disable persisting component’s state between page reloads.
Defaults to false
boolean
Enable or disable rendering component in right to left direction.
Defaults to false
string
| number
Defines the height of the Spreadsheet. It accepts height as pixels, number, and percentage.
<template>
<ejs-spreadsheet height="600px"> </ejs-spreadsheet>
</template>
<script>
import Vue from "vue";
import { SpreadsheetPlugin } from "@syncfusion/ej2-vue-spreadsheet";
Vue.use(SpreadsheetPlugin);
export default Vue.extend({});
</script>
Defaults to ‘100%’
boolean
Specifies to protect the workbook.
Defaults to false
string
Specifies the list separator which is used as the formula argument separator.
Defaults to ’,’
string
Overrides the global culture and localization value for this component. Default global culture is ‘en-US’.
Defaults to ”
Specifies the options for configuration when opening a document.
<template>
<ejs-spreadsheet :openUrl="openUrl" :saveUrl="saveUrl" :openSettings="openSettings"> </ejs-spreadsheet>
</template>
<script>
import Vue from "vue";
import { SpreadsheetPlugin } from "@syncfusion/ej2-vue-spreadsheet";
Vue.use(SpreadsheetPlugin);
export default Vue.extend({
data: () => {
return {
openUrl: "https://services.syncfusion.com/vue/production/api/spreadsheet/open",
saveUrl: "https://services.syncfusion.com/vue/production/api/spreadsheet/save",
// Configure the open settings.
openSettings: {
chunkSize: 100000,
retryCount: 3
},
};
},
});
</script>
Defaults to {}
string
Specifies the service URL to open excel file in spreadsheet.
Defaults to ”
string
Specifies the password.
Defaults to ”
string
Specifies the service URL to save spreadsheet as Excel file.
Defaults to ”
Configures sheets and its options.
<template>
<!-- Specifies the sheets and its options. -->
<ejs-spreadsheet>
<e-sheets>
<e-sheet name="Car Sales Report">
<e-ranges>
<e-range :dataSource="dataSource"></e-range>
</e-ranges>
<e-rows>
<e-row :index="rowIndex" :cells="cells"></e-row>
</e-rows>
<e-columns>
<e-column :width="width1"></e-column>
<e-column :width="width2"></e-column>
<e-column :width="width3"></e-column>
</e-columns>
</e-sheet>
</e-sheets>
</ejs-spreadsheet>
</template>
<script>
import Vue from "vue";
import { SpreadsheetPlugin } from "@syncfusion/ej2-vue-spreadsheet";
import { salesData } from "./data";
Vue.use(SpreadsheetPlugin);
export default Vue.extend({
data: () => {
return {
dataSource: salesData,
rowIndex: 30,
colIndex: 4,
cells: [
{
index: 4,
value: "Total Amount:",
style: { fontWeight: "bold", textAlign: "right" },
},
{ formula: "=SUM(F2:F30)", style: { fontWeight: "bold" } },
],
width1: 180,
width2: 130,
width3: 120,
openUrl:
"https://services.syncfusion.com/vue/production/api/spreadsheet/open",
saveUrl:
"https://services.syncfusion.com/vue/production/api/spreadsheet/save",
};
},
});
</script>
Defaults to []
boolean
It shows or hides the formula bar and its features.
Defaults to true
boolean
It shows or hides the ribbon in spreadsheet.
Defaults to true
boolean
It shows or hides the sheets tabs, this is used to navigate among the sheets and create or delete sheets by UI interaction.
Defaults to true
string
| number
Defines the width of the Spreadsheet. It accepts width as pixels, number, and percentage.
<template>
<!-- Specifies the width -->
<ejs-spreadsheet width="600px"></ejs-spreadsheet>
</template>
<script>
import Vue from "vue";
import { SpreadsheetPlugin } from "@syncfusion/ej2-vue-spreadsheet";
Vue.use(SpreadsheetPlugin);
export default Vue.extend({});
</script>
Defaults to ‘100%’
This method is used to unfreeze the frozen rows and columns from the active sheet.
Parameter | Type | Description |
---|---|---|
sheet (optional) | number | string |
Specifies the sheet name or index in which the unfreeze operation will perform. By default, active sheet will be considered. |
Returns void
To add custom library function.
Parameter | Type | Description |
---|---|---|
functionHandler | string | Function |
Custom function handler name |
functionName (optional) | string |
Custom function name |
formulaDescription (optional) | string |
Specifies formula description. |
<template>
<ejs-spreadsheet ref="spreadsheet" :created="created"> </ejs-spreadsheet>
</template>
<script>
import Vue from "vue";
import { SpreadsheetPlugin } from "@syncfusion/ej2-vue-spreadsheet";
Vue.use(SpreadsheetPlugin);
export default Vue.extend({
data: function () {
return {};
},
mounted() {
window.SQRTHandler = (num) => Math.sqrt(num);
},
methods: {
created: function () {
// Add custom library function to compute the square root of a number.
this.$refs.spreadsheet.addCustomFunction("SQRTHandler", "SQRT");
},
},
});
</script>
|
Returns void
Adds the defined name to the Spreadsheet.
Parameter | Type | Description |
---|---|---|
definedName | DefineNameModel |
Specifies the name. |
Returns boolean
Adds the handler to the given event listener.
Parameter | Type | Description |
---|---|---|
eventName | string |
A String that specifies the name of the event |
handler | Function |
Specifies the call to run when the event occurs. |
Returns void
Adding unload event to persist data when enable persistence true
Returns void
Used to perform autofill action based on the specified range in spreadsheet.
Parameter | Type | Description |
---|---|---|
fillRange | string |
Specifies the fill range. |
dataRange (optional) | string |
Specifies the data range. |
direction (optional) | AutoFillDirection |
Specifies the direction(“Down”,“Right”,“Up”,“Left”) to be filled. |
fillType (optional) | AutoFillType |
Specifies the fill type(“FillSeries”,“CopyCells”,“FillFormattingOnly”,“FillWithoutFormatting”) for autofill action. |
Returns void
The calculateNow
method is used to calculate any uncalculated formulas in a spreadsheet.
This method accepts an option to specify whether the calculation should be performed for the entire workbook or a specific sheet.
Returns Promise
Applies the style (font family, font weight, background color, etc…) to the specified range of cells.
<template>
<div class="control-section">
<ejs-spreadsheet ref="spreadsheet"> </ejs-spreadsheet>
<button @click="onClick">Apply Cell Format</button>
</div>
</template>
<script>
import Vue from "vue";
import { SpreadsheetPlugin } from "@syncfusion/ej2-vue-spreadsheet";
Vue.use(SpreadsheetPlugin);
export default Vue.extend({
methods: {
onClick: function () {
const spreadsheet = this.$refs.spreadsheet;
// Apply the styles to the cells in the specified range.
spreadsheet.cellFormat(
{
fontWeight: "bold",
fontSize: "12pt",
backgroundColor: "#279377",
color: "#ffffff",
},
"A2:E2"
);
spreadsheet.cellFormat(
{ verticalAlign: "middle", fontFamily: "Axettac Demo" },
"A2:E12"
);
spreadsheet.cellFormat({ textAlign: "center" }, "A2:A12");
// Apply text-indent to 2nd & 4th columns.
const style = { textAlign: "left", textIndent: "8pt" };
spreadsheet.cellFormat(style, "B2:B12");
spreadsheet.cellFormat(style, "D2:D12");
spreadsheet.cellFormat(
{ fontStyle: "italic", textAlign: "right" },
"C3:C12"
);
spreadsheet.cellFormat({ textAlign: "center" }, "E2:E12");
},
},
});
</script>
Parameter | Type | Description |
---|---|---|
style | CellStyleModel |
Specifies the cell style. |
range (optional) | string |
Specifies the address for the range of cells. |
Returns void
This method is used to Clear contents, formats and hyperlinks in spreadsheet.
Parameter | Type | Description |
---|---|---|
options | ClearOptions |
Options for clearing the content, formats and hyperlinks in spreadsheet. |
Returns void
Used to compute the specified expression/formula.
<template>
<div class="control-section">
<ejs-spreadsheet ref="spreadsheet"> </ejs-spreadsheet>
<button @click="onClick">To Compute Expression</button>
</div>
</template>
<script>
import Vue from "vue";
import { SpreadsheetPlugin } from "@syncfusion/ej2-vue-spreadsheet";
Vue.use(SpreadsheetPlugin);
export default Vue.extend({
methods: {
onClick: function () {
const spreadsheet = this.$refs.spreadsheet;
// Calculate the result of an arithmetic expression or formula.
spreadsheet.computeExpression("522+1");
spreadsheet.computeExpression("=SUM(F2:F3)");
},
},
});
</script>
Parameter | Type | Description |
---|---|---|
formula | string |
Specifies the formula(=SUM(A1:A3)) or expression(2+3). |
Returns string | number
When invoked, applies the pending property changes immediately to the component.
Returns void
Used to delete rows, columns and sheets from the spreadsheet.
<template>
<div class="control-section">
<ejs-spreadsheet ref="spreadsheet"> </ejs-spreadsheet>
<button @click="onClick">Delete Row & Column</button>
</div>
</template>
<script>
import Vue from "vue";
import { SpreadsheetPlugin } from "@syncfusion/ej2-vue-spreadsheet";
Vue.use(SpreadsheetPlugin);
export default Vue.extend({
methods: {
onClick: function () {
const spreadsheet = this.$refs.spreadsheet;
// To delete rows, columns, and sheets with the specified index.
spreadsheet.delete(1, 1, "Row", "Sheet1");
spreadsheet.delete(2, 2, "Column", "Sheet1");
},
},
});
</script>
Parameter | Type | Description |
---|---|---|
startIndex (optional) | number |
Specifies the start sheet / row / column index. |
endIndex (optional) | number |
Specifies the end sheet / row / column index. |
model (optional) | ModelType |
Specifies the delete model type. By default, the model is considered as Sheet . The possible values are,- Row: To delete rows. - Column: To delete columns. - Sheet: To delete sheets. |
sheet (optional) | number | string |
Specifies the sheet name or index in which the delete operation will perform. By default, active sheet will be considered. It is applicable only for model type Row and Column. |
Returns void
Used to delete the chart from spreadsheet.
<template>
<div class="control-section">
<ejs-spreadsheet ref="spreadsheet" :created="created"> </ejs-spreadsheet>
<button @click="onClick">Delete Chart</button>
</div>
</template>
<script>
import Vue from "vue";
import { SpreadsheetPlugin } from "@syncfusion/ej2-vue-spreadsheet";
Vue.use(SpreadsheetPlugin);
export default Vue.extend({
methods: {
onClick: function () {
// Delete the chart with the specified chart element ID from the spreadsheet.
this.$refs.spreadsheet.deleteChart("Chart");
},
created: function () {
// Insert a chart into a spreadsheet using the chart options specified.
this.$refs.spreadsheet.insertChart([
{
type: "Line",
theme: "Material",
isSeriesInRows: false,
range: "A1:B5",
id: "Chart",
},
]);
},
},
});
</script>
Parameter | Type | Description |
---|---|---|
id (optional) | string |
Specifies the chart element id. |
Returns void
Destroys the Workbook library.
Returns void
Removing unload event to persist data when enable persistence true
Returns void
Used to make a duplicate/copy of the sheet in the spreadsheet.
<template>
<div class="control-section">
<ejs-spreadsheet ref="spreadsheet"></ejs-spreadsheet>
<button @click="onClick">Make Duplicate Sheet</button>
</div>
</template>
<script>
import Vue from "vue";
import { SpreadsheetPlugin } from "@syncfusion/ej2-vue-spreadsheet";
Vue.use(SpreadsheetPlugin);
export default Vue.extend({
methods: {
onClick: function () {
const spreadsheet = this.$refs.spreadsheet;
// Make a duplicate/copy of the active sheet in the spreadsheet.
spreadsheet.duplicateSheet();
// Make a duplicate/copy of the specified sheet index in the spreadsheet.
spreadsheet.duplicateSheet(0);
},
},
});
</script>
Parameter | Type | Description |
---|---|---|
sheetIndex (optional) | number |
Specifies the index of the sheet to be duplicated. By default, the active sheet will be duplicated. |
Returns void
Filters the range of cells in the sheet.
Parameter | Type | Description |
---|---|---|
filterOptions (optional) | FilterOptions |
Specifies the filterOptions |
range (optional) | string |
Specifies the range |
Returns Promise
This method is used to freeze rows and columns after the specified cell in the Spreadsheet.
Parameter | Type | Description |
---|---|---|
row | number |
Specifies the freezed row count. |
column | number |
Specifies the freezed column count. |
sheet (optional) | number | string |
Specifies the sheet name or index in which the freeze operation will perform. By default, active sheet will be considered. |
Returns void
Gets the range of data as JSON from the specified address.
<template>
<div class="control-section">
<ejs-spreadsheet ref="spreadsheet"></ejs-spreadsheet>
<button @click="onClick">Get Data</button>
</div>
</template>
<script>
import Vue from "vue";
import { SpreadsheetPlugin } from "@syncfusion/ej2-vue-spreadsheet";
Vue.use(SpreadsheetPlugin);
export default Vue.extend({
methods: {
onClick: function () {
// Return the specified cell address data as JSON.
const spreadsheet = this.$refs.spreadsheet;
spreadsheet.getData("Sheet1!A1:B2").then((data) => console.log(data));
spreadsheet.getData("A1:B2").then((data) => console.log(data));
},
},
});
</script>
Parameter | Type | Description |
---|---|---|
address | string |
Specifies the address for range of cells. |
Returns Promise
Gets the formatted text of the cell.
<template>
<div class="control-section">
<ejs-spreadsheet ref="spreadsheet"></ejs-spreadsheet>
<button @click="onClick">Get Display Text</button>
</div>
</template>
<script>
import Vue from "vue";
import { SpreadsheetPlugin, getCell } from "@syncfusion/ej2-vue-spreadsheet";
Vue.use(SpreadsheetPlugin);
export default Vue.extend({
methods: {
onClick: function () {
const spreadsheet = this.$refs.spreadsheet;
// Get the cell model for the given row, column, and sheet indexes.
const cell = getCell(0, 0, spreadsheet.ej2Instances.getActiveSheet());
// To get the formatted cell value, specify the cell model.
spreadsheet.getDisplayText(cell);
},
},
});
</script>
Parameter | Type | Description |
---|---|---|
cell | CellModel |
Specifies the cell. |
Returns string
Returns the persistence data for component
Returns any
Returns the route element of the component
Returns HTMLElement
Used to get a row data from the data source with updated cell value.
Parameter | Type | Description |
---|---|---|
index (optional) | number |
Specifies the row index. |
sheetIndex (optional) | number |
Specifies the sheet index. By default, it consider the active sheet index. |
Returns Object[]
Handling unload event to persist data when enable persistence true
Returns void
Used to hide/show the columns in spreadsheet.
Parameter | Type | Description |
---|---|---|
startIndex | number |
Specifies the start column index. |
endIndex | number |
Specifies the end column index. |
hide | boolean |
Set true / false to hide / show the columns. |
Returns void
Used to hide/show the rows in spreadsheet.
Parameter | Type | Description |
---|---|---|
startIndex | number |
Specifies the start row index. |
endIndex | number |
Specifies the end row index. |
hide | boolean |
To hide/show the rows in specified range. |
Returns void
Used to set the chart in spreadsheet.
<template>
<div class="control-section">
<ejs-spreadsheet ref="spreadsheet"></ejs-spreadsheet>
<button @click="onClick">Insert Chart</button>
</div>
</template>
<script>
import Vue from "vue";
import { SpreadsheetPlugin } from "@syncfusion/ej2-vue-spreadsheet";
Vue.use(SpreadsheetPlugin);
export default Vue.extend({
methods: {
onClick: function () {
// Insert a chart into a spreadsheet using the chart options specified.
this.$refs.spreadsheet.insertChart([
{
type: "Line",
theme: "Material",
isSeriesInRows: false,
range: "A1",
id: "Chart1"
}
]);
},
},
});
</script>
Parameter | Type | Description |
---|---|---|
chart (optional) | ChartModel[] |
Specifies the options to insert chart in spreadsheet |
Returns void
Used to insert columns in to the spreadsheet.
<template>
<div class="control-section">
<ejs-spreadsheet ref="spreadsheet"></ejs-spreadsheet>
<button @click="onClick">Insert Column</button>
</div>
</template>
<script>
import Vue from "vue";
import { SpreadsheetPlugin } from "@syncfusion/ej2-vue-spreadsheet";
Vue.use(SpreadsheetPlugin);
export default Vue.extend({
methods: {
onClick: function () {
// Insert the column at the starting column index specified.
this.$refs.spreadsheet.insertColumn([{ index: 1, width: 95 }], 1);
},
},
});
</script>
Parameter | Type | Description |
---|---|---|
startColumn (optional) | number | ColumnModel[] |
Specifies the start column index / column model which needs to be inserted. |
endColumn (optional) | number |
Specifies the end column index. |
sheet (optional) | number | string |
Specifies the sheet name or index in which the insert operation will perform. By default, active sheet will be considered. |
Returns void
Used to set the image in spreadsheet.
Parameter | Type | Description |
---|---|---|
images | ImageModel[] |
Specifies the options to insert image in spreadsheet. |
range (optional) | string |
Specifies the range in spreadsheet. |
Returns void
Used to insert rows in to the spreadsheet.
<template>
<div class="control-section">
<ejs-spreadsheet ref="spreadsheet"></ejs-spreadsheet>
<button @click="onClick">Insert Row</button>
</div>
</template>
<script>
import Vue from "vue";
import { SpreadsheetPlugin } from "@syncfusion/ej2-vue-spreadsheet";
Vue.use(SpreadsheetPlugin);
export default Vue.extend({
methods: {
onClick: function () {
// Insert the row at the starting row index specified.
this.$refs.spreadsheet.insertRow(4, 4);
},
},
});
</script>
Parameter | Type | Description |
---|---|---|
startRow (optional) | number | RowModel[] |
Specifies the start row index / row model which needs to be inserted. |
endRow (optional) | number |
Specifies the end row index. |
sheet (optional) | number | string |
Specifies the sheet name or index in which the insert operation will perform. By default, active sheet will be considered. |
Returns void
Used to insert sheets in to the spreadsheet.
<template>
<div class="control-section">
<ejs-spreadsheet ref="spreadsheet"></ejs-spreadsheet>
<button @click="onClick">Insert Sheet</button>
</div>
</template>
<script>
import Vue from "vue";
import { SpreadsheetPlugin } from "@syncfusion/ej2-vue-spreadsheet";
Vue.use(SpreadsheetPlugin);
export default Vue.extend({
methods: {
onClick: function () {
// Insert the sheet at the starting sheet index specified.
this.$refs.spreadsheet.insertSheet(0, 2);
},
},
});
</script>
Parameter | Type | Description |
---|---|---|
startSheet (optional) | number | SheetModel[] |
Specifies the start sheet index / sheet model which needs to be inserted. |
endSheet (optional) | number |
Specifies the end sheet index. |
Returns void
To determine whether the cell value in a data validation applied cell is valid or not.
Parameter | Type | Description |
---|---|---|
cellAddress (optional) | string |
Address of the cell. |
Returns boolean
Applies cell lock to the specified range of cells.
<template>
<div class="control-section">
<ejs-spreadsheet ref="spreadsheet"></ejs-spreadsheet>
<button @click="onClick">Lock Cells</button>
</div>
</template>
<script>
import Vue from "vue";
import { SpreadsheetPlugin } from "@syncfusion/ej2-vue-spreadsheet";
Vue.use(SpreadsheetPlugin);
export default Vue.extend({
methods: {
onClick: function () {
const spreadsheet = this.$refs.spreadsheet;
//To protect the worksheet.
const protectSetting = {
selectCells: true,
formatCells: false,
formatRows: false,
formatColumns: false,
insertLink: false
};
spreadsheet.protectSheet("Sheet1", protectSetting);
// To unlock the A2:AZ100 cell range.
spreadsheet.lockCells("A2:AZ100", false);
// To lock the A1:Z1 cell range.
spreadsheet.lockCells("A1:Z1", true);
},
},
});
</script>
Parameter | Type | Description |
---|---|---|
range (optional) | string |
Specifies the address for the range of cells. |
isLocked (optional) | boolean |
-Specifies the cell is locked or not. |
Returns void
Used to merge the range of cells.
<template>
<ejs-spreadsheet ref="spreadsheet" :created="created"> </ejs-spreadsheet>
</template>
<script>
import Vue from "vue";
import { SpreadsheetPlugin } from "@syncfusion/ej2-vue-spreadsheet";
Vue.use(SpreadsheetPlugin);
export default Vue.extend({
methods: {
created: function () {
// To merge the cells in the specified range.
this.$refs.spreadsheet.merge("B1:E2");
},
},
});
</script>
Parameter | Type | Description |
---|---|---|
range (optional) | string |
Specifies the range of cells as address. |
type (optional) | MergeType |
Specifies the merge type. The possible values are, - All: Merge all the cells between provided range. - Horizontally: Merge the cells row-wise. - Vertically: Merge the cells column-wise. |
Returns void
Used to move the sheets to the specified position in the list of sheets.
<template>
<div class="control-section">
<ejs-spreadsheet ref="spreadsheet">
<e-sheets>
<e-sheet name="Car Sales Report"> </e-sheet>
<e-sheet name="Car Stock Report"> </e-sheet>
<e-sheet name="Car Discount Report"> </e-sheet>
</e-sheets>
</ejs-spreadsheet>
<button @click="onClick">Move Sheets</button>
</div>
</template>
<script>
import Vue from "vue";
import { SpreadsheetPlugin } from "@syncfusion/ej2-vue-spreadsheet";
Vue.use(SpreadsheetPlugin);
export default Vue.extend({
methods: {
onClick: function () {
const spreadsheet = this.$refs.spreadsheet;
// Moves the active sheet to the specified position.
spreadsheet.moveSheet(1);
// Moves the list of specified sheets to the specified position.
spreadsheet.moveSheet(0, [1, 2]);
},
},
});
</script>
Parameter | Type | Description |
---|---|---|
position | number |
Specifies the position to move a sheet in the list of sheets. |
sheetIndexes (optional) | number[] |
Specifies the indexes of the sheet to be moved. By default, the active sheet will be moved. |
Returns void
Applies the number format (number, currency, percentage, short date, etc…) to the specified range of cells.
<template>
<ejs-spreadsheet ref="spreadsheet" :created="created">
<e-sheets>
<e-sheet name="Car Sales Report">
<e-ranges>
<e-range :dataSource="dataSource"></e-range>
</e-ranges>
</e-sheet>
</e-sheets>
</ejs-spreadsheet>
</template>
<script>
import Vue from "vue";
import { salesData } from "./data";
import {
SpreadsheetPlugin,
getFormatFromType,
} from "@syncfusion/ej2-vue-spreadsheet";
Vue.use(SpreadsheetPlugin);
export default Vue.extend({
data: () => {
return {
dataSource: salesData,
};
},
methods: {
created: function () {
const spreadsheet = this.$refs.spreadsheet;
// Apply the number format to the specified range of cells.
spreadsheet.numberFormat("$#,##0.00", "E1:E3");
// Apply the accounting format to the specified range of cells.
spreadsheet.numberFormat(getFormatFromType("Accounting"), "C3:E10");
// Apply the percentage format to the specified range of cells.
spreadsheet.numberFormat("0%", "F3:F10");
},
},
});
</script>
Parameter | Type | Description |
---|---|---|
format | string |
Specifies the number format code. |
range (optional) | string |
Specifies the address of the range of cells. |
Returns void
Opens the specified excel file or stream.
Parameter | Type | Description |
---|---|---|
options | OpenOptions |
Options for opening the excel file. |
Returns void
Opens the specified JSON object.
<template>
<div class="control-section">
<ejs-spreadsheet
ref="spreadsheet"
:openUrl="openUrl"
:saveUrl="saveUrl"
></ejs-spreadsheet>
<button @click="Save">Save JSON</button>
<button @click="Open">Load JSON</button>
</div>
</template>
<script>
import Vue from "vue";
import { SpreadsheetPlugin } from "@syncfusion/ej2-vue-spreadsheet";
Vue.use(SpreadsheetPlugin);
export default Vue.extend({
data: function () {
return {
response: "",
openUrl:
"https://services.syncfusion.com/vue/production/api/spreadsheet/open",
saveUrl:
"https://services.syncfusion.com/vue/production/api/spreadsheet/save"
};
},
methods: {
Save: function () {
// Save the spreadsheet data as JSON.
this.$refs.spreadsheet.saveAsJson().then((Json) => (this.response = Json));
},
Open: function () {
// Load the JSON data to the spreadsheet.
this.$refs.spreadsheet.openFromJson({ file: this.response.jsonObject });
},
},
});
</script>
The available arguments in options are:
openComplete
event or not.Parameter | Type | Description |
---|---|---|
options | Object |
Options for opening the JSON object. |
jsonConfig (optional) | SerializationOptions |
Specify the serialization options to customize the loading of the JSON data. |
Returns void
Protect the active sheet based on the protect sheetings.
Parameter | Type | Description |
---|---|---|
sheet (optional) | number | string |
Specifies the sheet to protect. |
protectSettings (optional) | ProtectSettingsModel |
Specifies the protect settings of the sheet. |
password (optional) | string |
Specifies the password to protect |
Returns void
Applies all the pending property changes and render the component again.
Returns void
Removes the defined name from the Spreadsheet.
Parameter | Type | Description |
---|---|---|
definedName | string |
Specifies the name. |
scope | string |
Specifies the scope of the defined name. |
Returns boolean
Removes the handler from the given event listener.
Parameter | Type | Description |
---|---|---|
eventName | string |
A String that specifies the name of the event to remove |
handler | Function |
Specifies the function to remove |
Returns void
Saves the Spreadsheet data to Excel file.
<template>
<div class="control-section">
<ejs-spreadsheet
ref="spreadsheet"
:openUrl="openUrl"
:saveUrl="saveUrl"></ejs-spreadsheet>
<button @click="onClick">To Save</button>
</div>
</template>
<script>
import Vue from "vue";
import { SpreadsheetPlugin } from "@syncfusion/ej2-vue-spreadsheet";
Vue.use(SpreadsheetPlugin);
export default Vue.extend({
data: function () {
return {
openUrl:
"https://services.syncfusion.com/vue/production/api/spreadsheet/open",
saveUrl:
"https://services.syncfusion.com/vue/production/api/spreadsheet/save"
};
},
methods: {
onClick: function () {
// Save the spreadsheet data to an Excel file with the filename and extension you specify.
this.$refs.spreadsheet.save({
url: "https://services.syncfusion.com/vue/production/api/spreadsheet/save",
fileName: "Worksheet",
saveType: "Xlsx"
});
},
},
});
</script>
The available arguments in saveOptions are:
Parameter | Type | Description |
---|---|---|
saveOptions | SaveOptions |
Options for saving the excel file. |
jsonConfig (optional) | SerializationOptions |
Specify the serialization options to customize the JSON output. |
Returns void
Saves the Spreadsheet data as JSON object.
<template>
<div class="control-section">
<ejs-spreadsheet
ref="spreadsheet"
:openUrl="openUrl"
:saveUrl="saveUrl"
></ejs-spreadsheet>
<button @click="Save">Save JSON</button>
<button @click="Open">Load JSON</button>
</div>
</template>
<script>
import Vue from "vue";
import { SpreadsheetPlugin } from "@syncfusion/ej2-vue-spreadsheet";
Vue.use(SpreadsheetPlugin);
export default Vue.extend({
data: function () {
return {
response: "",
openUrl:
"https://services.syncfusion.com/vue/production/api/spreadsheet/open",
saveUrl:
"https://services.syncfusion.com/vue/production/api/spreadsheet/save"
};
},
methods: {
Save: function () {
// Save the spreadsheet data as JSON.
this.$refs.spreadsheet.saveAsJson().then((Json) => (this.response = Json));
},
Open: function () {
// Load the JSON data to the spreadsheet.
this.$refs.spreadsheet.openFromJson({ file: this.response.jsonObject });
},
},
});
</script>
Parameter | Type | Description |
---|---|---|
jsonConfig (optional) | SerializationOptions |
Specify the serialization options to customize the JSON output. |
Returns Promise
Sets the border to specified range of cells.
<template>
<div class="control-section">
<ejs-spreadsheet ref="spreadsheet"></ejs-spreadsheet>
<button @click="onClick">Set Border</button>
</div>
</template>
<script>
import Vue from "vue";
import { SpreadsheetPlugin } from "@syncfusion/ej2-vue-spreadsheet";
Vue.use(SpreadsheetPlugin);
export default Vue.extend({
methods: {
onClick: function () {
// Sets the border to the specified cell range.
this.$refs.spreadsheet.setBorder(
{ border: "1px solid #000000" },
"C6:G8",
"Outer"
);
this.$refs.spreadsheet.setBorder({ border: "1px solid #000000" });
},
},
});
</script>
Parameter | Type | Description |
---|---|---|
style | CellStyleModel |
Specifies the style property which contains border value. |
range (optional) | string |
Specifies the range of cell reference. If not specified, it will considered the active cell reference. |
type (optional) | BorderType |
Specifies the range of cell reference. If not specified, it will considered the active cell reference. |
isUndoRedo (optional) | boolean |
Specifies is undo redo or not. |
Returns void
Sorts the range of cells in the active Spreadsheet.
Parameter | Type | Description |
---|---|---|
sortOptions (optional) | SortOptions |
options for sorting. |
range (optional) | string |
address of the data range. |
previousSort (optional) | SortCollectionModel[] |
specifies previous sort collection. |
Returns Promise
Used to split the merged cell into multiple cells.
<template>
<div class="control-section">
<ejs-spreadsheet ref="spreadsheet" :created="created"> </ejs-spreadsheet>
<button @click="onClick">UnMerge Cells</button>
</div>
</template>
<script>
import Vue from "vue";
import { SpreadsheetPlugin } from "@syncfusion/ej2-vue-spreadsheet";
Vue.use(SpreadsheetPlugin);
export default Vue.extend({
methods: {
created: function () {
this.$refs.spreadsheet.merge("B1:E2");
},
onClick: function () {
//To split the merged cell into multiple cells.
this.$refs.spreadsheet.unMerge("B1:E2");
},
},
});
</script>
Parameter | Type | Description |
---|---|---|
range (optional) | string |
Specifies the range of cells as address. |
Returns void
This method is used to unfreeze the frozen rows and columns from spreadsheet.
Parameter | Type | Description |
---|---|---|
sheet (optional) | number | string |
Specifies the sheet name or index in which the unfreeze operation will perform. By default, active sheet will be considered. |
Returns void
Unprotect the active sheet.
Parameter | Type | Description |
---|---|---|
sheet | number | string |
Specifies the sheet to Unprotect. |
Returns void
Updates the properties of a specified cell.
<template>
<div class="control-section">
<ejs-spreadsheet ref="spreadsheet"></ejs-spreadsheet>
<button @click="onClick">Update Cell</button>
</div>
</template>
<script>
import Vue from "vue";
import { SpreadsheetPlugin } from "@syncfusion/ej2-vue-spreadsheet";
Vue.use(SpreadsheetPlugin);
export default Vue.extend({
methods: {
onClick: function () {
const spreadsheet = this.$refs.spreadsheet;
// Update the properties of a cell to the specified cell address.
spreadsheet.updateCell({ value: "Custom Value" }, "A3");
spreadsheet.updateCell({ value: "Custom Value" }, "Sheet1!A3");
},
},
});
</script>
Parameter | Type | Description |
---|---|---|
cell | CellModel |
The properties to update for the specified cell. |
address (optional) | string |
The address of the cell to update. If not provided, the active cell’s address will be used. |
enableDependentCellUpdate (optional) | boolean |
Specifies whether dependent cells should also be updated. Default value is |
Returns void
This method is used to update the Range property in specified sheet index.
Returns void
This method is used to wrap/unwrap the text content of the cell.
<template>
<div class="control-section">
<ejs-spreadsheet ref="spreadsheet"></ejs-spreadsheet>
<button @click="onClick">To Wrap</button>
</div>
</template>
<script>
import Vue from "vue";
import { SpreadsheetPlugin } from "@syncfusion/ej2-vue-spreadsheet";
Vue.use(SpreadsheetPlugin);
export default Vue.extend({
methods: {
onClick: function () {
// To wrap/unwrap the cell's text content with the specified address.
this.$refs.spreadsheet.wrap("B5", true);
},
},
});
</script>
Parameter | Type | Description |
---|---|---|
address | string |
Address of the cell to be wrapped. |
wrap | boolean |
Set false if the text content of the cell to be unwrapped. |
Returns void
Dynamically injects the required modules to the component.
Parameter | Type | Description |
---|---|---|
moduleList | Function[] |
? |
Returns void
EmitType<BeforeCellFormatArgs>
Triggers before the cell format applied to the cell.
<div id='Spreadsheet'></div>
new Spreadsheet({
beforeCellFormat: (args: BeforeCellFormatArgs) => {
}
...
}, '#Spreadsheet');
EmitType<BeforeCellUpdateArgs>
Triggers before changing any cell properties.
<div id='Spreadsheet'></div>
new Spreadsheet({
beforeCellUpdate: (args: BeforeCellUpdateArgs) => {
}
...
}, '#Spreadsheet');
Triggers before opening an Excel file.
<div id='Spreadsheet'></div>
new Spreadsheet({
beforeOpen: (args: BeforeOpenEventArgs) => {
}
...
}, '#Spreadsheet');
Triggers before saving the Spreadsheet as Excel file.
<div id='Spreadsheet'></div>
new Spreadsheet({
beforeSave: (args: BeforeSaveEventArgs) => {
}
...
}, '#Spreadsheet');
Triggers when the opened Excel file fails to load.
<div id='Spreadsheet'></div>
new Spreadsheet({
openFailure: (args: OpenFailureArgs) => {
}
...
}, '#Spreadsheet');
Triggered every time a request is made to access cell information.
<div id='Spreadsheet'></div>
new Spreadsheet({
queryCellInfo: (args: CellInfoEventArgs) => {
}
...
}, '#Spreadsheet');
EmitType<SaveCompleteEventArgs>
Triggers after saving the Spreadsheet as Excel file.
<div id='Spreadsheet'></div>
new Spreadsheet({
saveComplete: (args: SaveCompleteEventArgs) => {
}
...
}, '#Spreadsheet');