Skip to content

Commit 9a5cca6

Browse files
committed
1014442: modified content in open/save json for how to session
1 parent a521c08 commit 9a5cca6

10 files changed

Lines changed: 20 additions & 38 deletions

File tree

Document-Processing/Excel/Spreadsheet/React/how-to/paste-values-without-formatting.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
layout: post
33
title: Paste Without Formatting in React Spreadsheet component | Syncfusion
4-
description: Paste only raw values without formatting during copy and paste in Syncfusion React Spreadsheet component of Syncfusion Essential JS 2 and more.
4+
description: Learn here about Paste only values without formatting during copy and paste in Syncfusion React Spreadsheet component of Syncfusion Essential JS 2 and more.
55
control: Spreadsheet
66
platform: document-processing
77
documentation: ug
@@ -11,7 +11,7 @@ documentation: ug
1111

1212
In the Syncfusion React Spreadsheet, you can make the paste action insert only the raw values into the cells, without bringing any formatting or styles from the copied content. This can be done by using the [actionBegin](https://ej2.syncfusion.com/documentation/api/spreadsheet/index-default#actionbegin) event, where the Spreadsheet provides the details of the action being performed. When the action is a clipboard operation, you can set the paste type to Values, ensuring that only plain values are pasted into the sheet.
1313

14-
The following example shows how `actionBegin` makes the Spreadsheet paste values without formatting.
14+
The following example shows how to paste values without formatting.
1515

1616
{% tabs %}
1717
{% highlight js tabtitle="app.jsx" %}

Document-Processing/Excel/Spreadsheet/React/open-excel-files.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,15 +162,13 @@ Please find the code to fetch the blob data and load it into the Spreadsheet com
162162
163163
### Load Workbook as JSON
164164
165-
The Spreadsheet component allows you to load an entire workbook by using JSON object. This JSON object is given directly as a data source or typically generated on the server when an Excel file is converted, but also suitable for manual creation or editing—contains all workbook details such as sheets, cell values, formulas, styles, and formatting.
165+
The Spreadsheet component allows you to load an entire workbook by using a JSON object. This JSON is usually created on the server after converting an Excel file, but it can also be generated manually. The method reads the JSON and restores all sheets, cells, styles, formulas, formatting, and other workbook details inside the component.
166166
167-
You can also create JSON object by [configuring deserialization options](https://help.syncfusion.com/document-processing/excel/spreadsheet/react/open-save#configure-json-deserialization-options) and passing them as arguments to the [openFromJson](https://ej2.syncfusion.com/react/documentation/api/spreadsheet/index-default#openfromjson) method to restore the workbook's structure and appearance. When the method loads the JSON, it restores all workbook details, including sheets, cell values, styles, formulas, and formatting.
167+
You can also pass optional deserialization options to the [openFromJson](https://ej2.syncfusion.com/react/documentation/api/spreadsheet/index-default#openfromjson) method to selectively ignore certain features when loading the JSON (for example, styles, formulas, number formats, images, or conditional formats). These deserialization options are optional; if they are not provided, the method restores the full workbook details by default.
168168
169169
Reference: Guide to Creating the JSON Structure: https://help.syncfusion.com/document-processing/excel/spreadsheet/react/how-to/create-a-object-structure.
170170
171-
Overall, this JSON‑based approach offers a faster and more consistent experience when loading large or complex Excel files, ensuring smooth rendering within the Spreadsheet component.
172-
173-
Please find the code to fetch the JSON data and load it into the Spreadsheet component below.
171+
The following code example shows how to load workbook as JSON into the Spreadsheet component.
174172
175173
{% tabs %}
176174
{% highlight js tabtitle="app.jsx" %}

Document-Processing/Excel/Spreadsheet/React/rows-and-columns.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ You can provide the following type of ranges to the method:
162162
* Multiple rows with discontinuous range: `['1:10', '15:25', '30:40']`
163163
* Multiple rows with different sheets: `[Sheet1!1:50, 'Sheet2!1:50', 'Sheet3!1:50']`
164164

165-
Additionally, each row model includes a `customHeight` property that indicates the row height was explicitly set either by manually adjusting the row header boundary or programmatically. When `customHeight` is true, the height is treated as manually defined and will not change automatically when enabling wrap text, increasing font size, or changing the font family; the height remains fixed until the user or code updates it.
165+
Additionally, each row model includes a [customHeight](https://ej2.syncfusion.com/react/documentation/api/spreadsheet/rowmodel#customheight) property that indicates the row height was explicitly set either by manually adjusting the row header boundary or programmatically. When [customHeight](https://ej2.syncfusion.com/react/documentation/api/spreadsheet/rowmodel#customheight) is true, the height is treated as manually defined and will not change automatically when enabling wrap text, increasing font size, or changing the font family; the height remains fixed until the user or code updates it.
166166

167167
The following code example shows how to change the height for single/multiple rows in the spreadsheet.
168168

@@ -194,7 +194,7 @@ You can provide the following type of ranges to the method:
194194
* Multiple columns with discontinuous range: `['A:C', 'G:I', 'K:M']`
195195
* Multiple columns with different sheets: `[Sheet1!A:H, 'Sheet2!A:H', 'Sheet3!A:H']`
196196

197-
Additionally, each column model includes a `customWidth` property that indicates the column width was explicitly set either by manually adjusting the column header boundary or programmatically. When `customWidth` is true, the width is treated as manually defined.
197+
Additionally, each column model includes a [customWidth](https://ej2.syncfusion.com/react/documentation/api/spreadsheet/columnmodel#customwidth) property that indicates the column width was explicitly set either by manually adjusting the column header boundary or programmatically. When [customWidth](https://ej2.syncfusion.com/react/documentation/api/spreadsheet/columnmodel#customwidth) is true, the width is treated as manually defined.
198198

199199
The following code example shows how to change the width for single/multiple columns in the spreadsheet.
200200

Document-Processing/Excel/Spreadsheet/React/save-excel-files.md

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -136,16 +136,11 @@ Please find below the code to retrieve blob data from the Spreadsheet control be
136136
137137
### Save Workbook as JSON
138138
139-
The Spreadsheet component allows you to save an entire workbook as a JSON object. This JSON object, which contains all workbook details such as sheets, cell values, formulas, styles, formatting, and other settings—can be stored, transferred, or used later to recreate the workbook.
139+
The Spreadsheet component allows you to save an entire workbook as a JSON object. This JSON typically contains workbook details such as sheets, cell values, formulas, styles, and formatting.
140140
141-
You can also customize the generated JSON object by [configuring serialization options](https://help.syncfusion.com/document-processing/excel/spreadsheet/react/open-save#configure-json-serialization-options) and passing them as arguments to the [saveAsJson](https://ej2.syncfusion.com/react/documentation/api/spreadsheet/index-default#saveasjson) method to control how the workbook is exported as JSON.
141+
You can optionally pass serialization options to the [saveAsJson](https://ej2.syncfusion.com/react/documentation/api/spreadsheet/index-default#saveasjson) method to selectively ignore certain features when exporting the workbook as JSON — for example, styles, formulas, number formats, images, or conditional formats. These serialization options are optional; if they are not provided, the method exports the full workbook by default.
142142
143-
Reference: Guide to Creating the JSON Structure:
144-
https://help.syncfusion.com/document-processing/excel/spreadsheet/react/how-to/create-a-object-structure
145-
146-
Overall, this JSON‑based approach offers a faster and more efficient way to save large or complex Excel files, producing lightweight JSON that is easy to store, process, or transmit.
147-
148-
Please find below the code to retrieve JSON data from the Spreadsheet component.
143+
The following code example shows how to save workbook as JSON data from the Spreadsheet component.
149144
150145
{% tabs %}
151146
{% highlight js tabtitle="app.jsx" %}

Document-Processing/code-snippet/spreadsheet/react/open-from-json-cs1/app/app.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ function App() {
1616
<div className="control-section spreadsheet-control">
1717
<div style={{ padding: '8px 0' }}>
1818
<button className="e-btn e-primary" onClick={handleOpenFromJson}>
19-
Open from JSON
19+
Load workbook JSON
2020
</button>
2121
</div>
2222
<div>

Document-Processing/code-snippet/spreadsheet/react/open-from-json-cs1/app/app.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ function App(): React.ReactElement {
1616
<div className="control-section spreadsheet-control">
1717
<div style={{ padding: '8px 0' }}>
1818
<button className="e-btn e-primary" onClick={handleOpenFromJson}>
19-
Open from JSON
19+
Load workbook JSON
2020
</button>
2121
</div>
2222
<div>

Document-Processing/code-snippet/spreadsheet/react/paste-values-cs1/app/app.jsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,9 @@ function App() {
77
const spreadsheetRef = React.useRef<SpreadsheetComponent | null>(null);
88

99
const actionBegin = (args) => {
10-
const action = args.action;
11-
const eventArgs = args.args.eventArgs;
12-
1310
// If the user is pasting, force paste to values only.
14-
if (action === "clipboard") {
15-
eventArgs.type = 'Values';
11+
if (args.action === "clipboard") {
12+
args.args.eventArgs.type = 'Values';
1613
}
1714
};
1815

Document-Processing/code-snippet/spreadsheet/react/paste-values-cs1/app/app.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,9 @@ function App(): React.ReactElement {
77
const spreadsheetRef = React.useRef<SpreadsheetComponent | null>(null);
88

99
const actionBegin = (args: any): void => {
10-
const action: string = args.action;
11-
const eventArgs: any = args.args.eventArgs;
12-
1310
// If the user is pasting, force paste to values only.
14-
if (action === "clipboard") {
15-
eventArgs.type = 'Values';
11+
if (args.action === "clipboard") {
12+
args.args.eventArgs.type = 'Values';
1613
}
1714
};
1815

Document-Processing/code-snippet/spreadsheet/react/save-as-json-cs1/app/app.jsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,8 @@ function App() {
99

1010
const handleSaveAsJson = React.useCallback(async () => {
1111
if (!spreadsheetRef.current) return;
12-
const options = {};
13-
const result = await spreadsheetRef.current.saveAsJson(options);
14-
const jsonObject = result && (result).jsonObject ? (result).jsonObject : result;
15-
const content = typeof jsonObject === 'string' ? jsonObject : JSON.stringify(jsonObject, null, 2);
12+
const result = await spreadsheetRef.current.saveAsJson();
13+
const content = JSON.stringify(jsonObject, null, 2);
1614
setSavedJson(content);
1715
}, []);
1816

Document-Processing/code-snippet/spreadsheet/react/save-as-json-cs1/app/app.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import * as React from 'react';
22
import { createRoot } from 'react-dom/client';
33
import { SpreadsheetComponent } from '@syncfusion/ej2-react-spreadsheet';
4-
import type { SerializationOptions } from '@syncfusion/ej2-react-spreadsheet';
54

65
function App(): React.ReactElement {
76
const spreadsheetRef = React.useRef<SpreadsheetComponent | null>(null);
@@ -10,10 +9,8 @@ function App(): React.ReactElement {
109

1110
const handleSaveAsJson = React.useCallback(async () => {
1211
if (!spreadsheetRef.current) return;
13-
const options: SerializationOptions = {};
14-
const result: any = await spreadsheetRef.current.saveAsJson(options);
15-
const jsonObject: any = result && (result as any).jsonObject ? (result as any).jsonObject : result;
16-
const content: string = typeof jsonObject === 'string' ? jsonObject : JSON.stringify(jsonObject, null, 2);
12+
const result: any = await spreadsheetRef.current.saveAsJson();
13+
const content: string = JSON.stringify(result, null, 2);
1714
setSavedJson(content);
1815
}, []);
1916

0 commit comments

Comments
 (0)