Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ Now the Spreadsheet server Docker instance runs on localhost with the provided p
<div id='Spreadsheet'></div>
<script>
// Initialize Spreadsheet component.
const spreadsheet = new ej.spreadsheet.Spreadsheet({
var spreadsheet = new ej.spreadsheet.Spreadsheet({
openUrl: 'http://localhost:6002/api/spreadsheet/open',
saveUrl: 'http://localhost:6002/api/spreadsheet/save'
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ Compared to Excel, the date, time, currency, and accounting formats vary across
The code below illustrates how culture-based format codes are mapped to their corresponding number format ID for the `German (de)` culture.

```js
const deLocaleFormats = [
var deLocaleFormats = [
{ id: 14, code: 'dd.MM.yyyy' },
{ id: 15, code: 'dd. MMM yy' },
{ id: 16, code: 'dd. MMM' },
Expand Down
34 changes: 17 additions & 17 deletions Document-Processing/Excel/Spreadsheet/Javascript-ES5/open-save.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,11 @@ var spreadsheet = new ej.spreadsheet.Spreadsheet({
beforeOpen: (eventArgs) => {
eventArgs.cancel = true; // To prevent the default open action.
if (eventArgs.file) {
const reader = new FileReader();
var reader = new FileReader();
reader.readAsDataURL(eventArgs.file);
reader.onload = () => {
// Removing the xlsx file content-type.
const base64Data = reader.result.replace('data:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;base64,', '');
var base64Data = reader.result.replace('data:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;base64,', '');
openExcel({
file: base64Data,
extension: eventArgs.file.name.slice(eventArgs.file.name.lastIndexOf('.') + 1),
Expand All @@ -180,7 +180,7 @@ var spreadsheet = new ej.spreadsheet.Spreadsheet({
}
}
});
const openExcel = (requestData) => {
var openExcel = (requestData) => {
// Fetch call to AWS server for open processing.
fetch('https://xxxxxxxxxxxxxxxxxx.amazonaws.com/Prod/api/spreadsheet/open', {
method: 'POST',
Expand Down Expand Up @@ -344,7 +344,7 @@ The following code example demonstrates the client-side and server-side configur
**Client Side**:

```javascript
const spreadsheet = new ej.spreadsheet.Spreadsheet({
var spreadsheet = new ej.spreadsheet.Spreadsheet({
openSettings: {
// Specifies the size (in bytes) of each chunk for the server response when opening a document.
chunkSize: 1000000,
Expand Down Expand Up @@ -497,7 +497,7 @@ By default, the Spreadsheet control saves the Excel file and downloads it to the

// Convert the spreadsheet workbook to JSON data.
spreadsheet.saveAsJson().then((json) => {
const formData = new FormData();
var formData = new FormData();
formData.append('FileName', "Sample");
formData.append('saveType', 'Xlsx');
// Passing the JSON data to perform the save operation.
Expand Down Expand Up @@ -581,11 +581,11 @@ var spreadsheet = new ej.spreadsheet.Spreadsheet({
}
}
});
const saveAsExcel = (eventArgs) => {
var saveAsExcel = (eventArgs) => {
// Convert the spreadsheet workbook to JSON data.
spreadsheet.saveAsJson().then(Json => {
saveInitiated = false;
const formData = new FormData();
var formData = new FormData();
// Passing the JSON data to server to perform save operation.
formData.append('JSONData', JSON.stringify(Json.jsonObject.Workbook));
formData.append('saveType', 'Xlsx');
Expand All @@ -599,23 +599,23 @@ const saveAsExcel = (eventArgs) => {
return response.blob();
}
}).then(data => {
const reader = new FileReader();
var reader = new FileReader();
reader.onload = function () {
//Converts the result of the file reading operation into a base64 string.
const textBase64Str = reader.result.toString();
var textBase64Str = reader.result.toString();
//Converts the base64 string into a Excel base64 string.
const excelBase64Str = atob(textBase64Str.replace('data:text/plain;base64,', ''));
var excelBase64Str = atob(textBase64Str.replace('data:text/plain;base64,', ''));
//Converts the Excel base64 string into byte characters.
const byteCharacters = atob(excelBase64Str.replace('data:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;base64,', ''));
const byteArrays = [];
for (let i = 0; i < byteCharacters.length; i++) {
var byteCharacters = atob(excelBase64Str.replace('data:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;base64,', ''));
var byteArrays = [];
for (var i = 0; i < byteCharacters.length; i++) {
byteArrays.push(byteCharacters.charCodeAt(i));
}
const byteArray = new Uint8Array(byteArrays);
var byteArray = new Uint8Array(byteArrays);
//creates a blob data from the byte array with xlsx content type.
const blobData = new Blob([byteArray], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' });
const blobUrl = URL.createObjectURL(blobData);
const anchor = document.createElement('a');
var blobData = new Blob([byteArray], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' });
var blobUrl = URL.createObjectURL(blobData);
var anchor = document.createElement('a');
anchor.download = 'Sample.xlsx';
anchor.href = blobUrl;
document.body.appendChild(anchor);
Expand Down
4 changes: 2 additions & 2 deletions Document-Processing/Excel/Spreadsheet/Javascript-ES5/sort.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ You can also enable or disable this property using `beforeSort` event arguments,

```ts

let spreadsheet: Spreadsheet = new Spreadsheet({
var spreadsheet: Spreadsheet = new Spreadsheet({

beforeSort: function (args) {
args.sortOptions.containsHeader = true;
Expand All @@ -79,7 +79,7 @@ You can also enable or disable this property using `beforeSort` event arguments,

```ts

let spreadsheet: Spreadsheet = new Spreadsheet({
var spreadsheet: Spreadsheet = new Spreadsheet({

beforeSort: function (args) {
args.sortOptions.caseSensitive = true;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ej.base.enableRipple(true);

let spreadsheet = new ej.spreadsheet.Spreadsheet({
var spreadsheet = new ej.spreadsheet.Spreadsheet({
openUrl: 'https://document.syncfusion.com/web-services/spreadsheet-editor/api/spreadsheet/open',
saveUrl: 'https://document.syncfusion.com/web-services/spreadsheet-editor/api/spreadsheet/save',
openComplete: function() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//Initialize action items.
let items = [
var items = [
{
text: "Copy"
},
Expand All @@ -12,7 +12,7 @@ let items = [
];

// Initialize the DropDownButton component.
let drpDownBtn = new ej.splitbuttons.DropDownButton({
var drpDownBtn = new ej.splitbuttons.DropDownButton({
items: items,
cssClass: "e-round-corner",
select: (args) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//Initialize action items.
let items = [
var items = [
{
text: "Copy"
},
Expand All @@ -12,7 +12,7 @@ let items = [
];

// Initialize the DropDownButton component.
let drpDownBtn = new ej.splitbuttons.DropDownButton({
var drpDownBtn = new ej.splitbuttons.DropDownButton({
items: items,
cssClass: "e-round-corner",
select: (args) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
ej.base.enableRipple(true);

let spreadsheet = new ej.spreadsheet.Spreadsheet({
var spreadsheet = new ej.spreadsheet.Spreadsheet({
beforeCellRender: function (args) {
if (
args.colIndex >= 0 &&
args.colIndex <= 10 &&
args.element.classList.contains('e-header-cell')
) {
let text = 'custom header ' + args.colIndex.toString();
var text = 'custom header ' + args.colIndex.toString();
args.element.innerText = text;
}
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
let defaultData = [
var defaultData = [
{
"Customer Name": "Romona Heaslip",
"Model": "Taurus",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@

let sheet = [{
var sheet = [{
ranges: [{ dataSource: defaultData }],
columns: [
{ width: 180 }, { width: 130 }, { width: 130 }, { width: 180 },
{ width: 130 }, { width: 120 }
]
}];

let spreadsheet = new ej.spreadsheet.Spreadsheet({
var spreadsheet = new ej.spreadsheet.Spreadsheet({
sheets: sheet,
created: function () {
// Applies cell formatting to specified range of the active sheet
Expand All @@ -18,7 +18,7 @@ let spreadsheet = new ej.spreadsheet.Spreadsheet({
spreadsheet.appendTo('#spreadsheet');

document.getElementById("updateDynamicData").onclick = () => {
let newDataCollection = {
var newDataCollection = {
dataSource: [
{
'Payment Mode': 'Debit Card',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

let defaultData = [
var defaultData = [
{
"Customer Name": "Romona Heaslip",
"Model": "Taurus",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@

let sheet = [{
var sheet = [{
ranges: [{ dataSource: defaultData }],
columns: [
{ width: 180 }, { width: 130 }, { width: 130 }, { width: 180 },
{ width: 130 }, { width: 120 }
]
}];

let spreadsheet = new ej.spreadsheet.Spreadsheet({
var spreadsheet = new ej.spreadsheet.Spreadsheet({
sheets: sheet,
created: function () {
// Applies cell formatting to specified range of the active sheet
spreadsheet.cellFormat({ fontWeight: 'bold', textAlign: 'center', verticalAlign: 'middle' }, 'A1:F1');
// Construct the predicate model to be updated to the data.
let predicates = [{
var predicates = [{
field: 'C',
operator: 'equal',
value: 'Pink',
Expand All @@ -27,13 +27,13 @@ let spreadsheet = new ej.spreadsheet.Spreadsheet({
spreadsheet.appendTo('#spreadsheet');

document.getElementById("getFilterData").onclick = () => {
let activeSheet = spreadsheet.getActiveSheet();
let usedRange = activeSheet.usedRange;
for (let i = 0; i <= usedRange.rowIndex; i++) {
var activeSheet = spreadsheet.getActiveSheet();
var usedRange = activeSheet.usedRange;
for (var i = 0; i <= usedRange.rowIndex; i++) {
// Get the filtered row using isFiltered property.
let filteredRow = (activeSheet.rows[i]).isFiltered;
var filteredRow = (activeSheet.rows[i]).isFiltered;
if (!filteredRow) {
let rowData = spreadsheet.getRowData(i);
var rowData = spreadsheet.getRowData(i);
console.log("Row:", i + 1, "Cells", rowData);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ej.base.enableRipple(true);

let spreadsheet = new ej.spreadsheet.Spreadsheet({
var spreadsheet = new ej.spreadsheet.Spreadsheet({
contextMenuBeforeOpen: function (args) {
if (ejs.base.closest(args.event.target, '.e-sheet-content')) {
console.log('Cell Context Menu');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
ej.base.enableRipple(true);

// Loading the culture-related files.
const loadCultureFiles = (locales) => {
const files = ['ca-gregorian', 'numbers', 'timeZoneNames', 'currencies', 'numberingSystems'];
var loadCultureFiles = (locales) => {
var files = ['ca-gregorian', 'numbers', 'timeZoneNames', 'currencies', 'numberingSystems'];
locales.forEach((locale) => {
for (const fileName of files) {
const url = './cldr-data/' + (fileName === 'numberingSystems' ? '' : (locale + '/')) + fileName + '.json';
const ajax = new ej.base.Ajax(url, 'GET', false);
for (var fileName of files) {
var url = './cldr-data/' + (fileName === 'numberingSystems' ? '' : (locale + '/')) + fileName + '.json';
var ajax = new ej.base.Ajax(url, 'GET', false);
ajax.onSuccess = (value) => ej.base.loadCldr(JSON.parse(value));
ajax.send();
}
Expand All @@ -19,7 +19,7 @@ ej.base.setCulture('de');
// Setting currency code for the German culture.
ej.base.setCurrencyCode('EUR');

const localeFormats = {
var localeFormats = {
'de': [{ id: 37, code: '#,##0;-#,##0' }, { id: 38, code: '#,##0;[Red]-#,##0' },
{ id: 39, code: '#,##0.00;-#,##0.00' }, { id: 40, code: '#,##0.00;[Red]-#,##0.00' }, { id: 5, code: '#,##0 "€";-#,##0 "€"' },
{ id: 6, code: '#,##0 "€";[Red]-#,##0 "€"' }, { id: 7, code: '#,##0.00 "€";-#,##0.00 "€"' },
Expand Down Expand Up @@ -50,7 +50,7 @@ const localeFormats = {
// Mapping default number formats for the 'de' locale before the spreadsheet is created.
ej.spreadsheet.configureLocalizedFormat(null, localeFormats['de']);

const spreadsheet = new ej.spreadsheet.Spreadsheet({
var spreadsheet = new ej.spreadsheet.Spreadsheet({
locale: 'de',
listSeparator: ';',
sheets: [{
Expand All @@ -68,7 +68,7 @@ const spreadsheet = new ej.spreadsheet.Spreadsheet({
spreadsheet.appendTo('#spreadsheet');

// Setting culture-specific number formats for cells.
const applyFormats = () => {
var applyFormats = () => {
// Apply format to the specified range in the active sheet.
// The getFormatFromType method returns the culture-based format code based on the mapped formats.
// If a format ID is not mapped or is not applicable, it will return the format code based on the loaded culture.
Expand Down Expand Up @@ -103,9 +103,9 @@ new ej.dropdowns.DropDownList(
popupHeight: '200px',
placeholder: 'Select Locale',
change: (args) => {
const localeOption = args.value.split(' ');
var localeOption = args.value.split(' ');
// Setting the culture name like 'de', 'fr-CH', 'zh', and 'en-US'.
const cultureName = localeOption[0];
var cultureName = localeOption[0];
ej.base.setCulture(cultureName);
// Setting the currency code for the selected locale like 'EUR', 'CNY', 'CHF', and 'USD'.
ej.base.setCurrencyCode(localeOption[1]);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Initialize the Spreadsheet component.
var columns = [{ width: 100 }, { width: 100 },{ width: 100},
{ width: 100 }];
let spreadsheet = new ej.spreadsheet.Spreadsheet({
var spreadsheet = new ej.spreadsheet.Spreadsheet({
sheets: [{ name: 'Budget', ranges: [{ dataSource: budgetData }], columns: columns,isProtected: true, protectSettings: {selectCells: true} },
{name: 'Salary', ranges: [{ dataSource: salaryData }], columns: columns}],
dataBound: function () {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Initialize the Spreadsheet component.
var columns = [{ width: 100 }, { width: 100 },{ width: 100},
{ width: 100 }];
let spreadsheet = new ej.spreadsheet.Spreadsheet({
var spreadsheet = new ej.spreadsheet.Spreadsheet({
isProtected: true,
sheets: [{ name: 'Budget', ranges: [{ dataSource: budgetData }], columns: columns }],
dataBound: function () {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Initialize the Spreadsheet component.
var columns = [{ width: 100 }, { width: 100 },{ width: 100},
{ width: 100 }];
let spreadsheet = new ej.spreadsheet.Spreadsheet({
var spreadsheet = new ej.spreadsheet.Spreadsheet({
password: 'syncfusion',
sheets: [{ name: 'Budget', ranges: [{ dataSource: budgetData }], columns: columns }],
dataBound: function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,15 @@ var spreadsheet = new ej.spreadsheet.Spreadsheet({
spreadsheet.appendTo('#spreadsheet');

function appendDropdownBtn(id) {
let ddlItems = [
var ddlItems = [
{
text: 'Download Excel',
},
{
text: 'Download CSV',
},
];
let btnObj = new ej.splitbuttons.DropDownButton({
var btnObj = new ej.splitbuttons.DropDownButton({
items: ddlItems,
content: 'Download',
iconCss: 'e-icons e-download',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

let defaultData = [
var defaultData = [
{
"Customer Name": "Romona Heaslip",
"Model": "Taurus",
Expand Down
Loading