Skip to content

Commit 9a35ec1

Browse files
Merge pull request #2366 from syncfusion-content/EJ2-1014442-ug
Documentation(EJ2-1014442): Documentation Improvement - User Guide Enhancement
2 parents a161f8e + 8df96df commit 9a35ec1

21 files changed

Lines changed: 2061 additions & 9 deletions

File tree

Document-Processing-toc.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5455,6 +5455,7 @@
54555455
<li><a href="/document-processing/excel/spreadsheet/react/how-to/add-dynamic-cell-template">Add dynamic cell templates</a></li>
54565456
<li><a href="/document-processing/excel/spreadsheet/react/how-to/add-cell-icon">Add an icon to the cell</a></li>
54575457
<li><a href="/document-processing/excel/spreadsheet/react/how-to/get-filtered-data">Get the filtered row data</a></li>
5458+
<li><a href="/document-processing/excel/spreadsheet/react/how-to/paste-only-values-without-formatting">Paste only values without formatting and styles</a></li>
54585459
</ul>
54595460
</li>
54605461
<li><a href="/document-processing/excel/spreadsheet/react/mobile-responsiveness">Mobile Responsiveness</a></li>
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
layout: post
3+
title: Paste Without Formatting in React Spreadsheet component | Syncfusion
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.
5+
control: Spreadsheet
6+
platform: document-processing
7+
documentation: ug
8+
---
9+
10+
# Paste Values Without Formatting and styles in React Spreadsheet
11+
12+
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/react/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.
13+
14+
The following example shows how to paste values without formatting.
15+
16+
{% tabs %}
17+
{% highlight js tabtitle="app.jsx" %}
18+
{% include code-snippet/spreadsheet/react/paste-values-cs1/app/app.jsx %}
19+
{% endhighlight %}
20+
{% highlight ts tabtitle="app.tsx" %}
21+
{% include code-snippet/spreadsheet/react/paste-values-cs1/app/app.tsx %}
22+
{% endhighlight %}
23+
{% highlight js tabtitle="datasource.jsx" %}
24+
{% include code-snippet/spreadsheet/react/paste-values-cs1/app/datasource.jsx %}
25+
{% endhighlight %}
26+
{% highlight ts tabtitle="datasource.tsx" %}
27+
{% include code-snippet/spreadsheet/react/paste-values-cs1/app/datasource.tsx %}
28+
{% endhighlight %}
29+
{% endtabs %}
30+
31+
{% previewsample "/document-processing/code-snippet/spreadsheet/react/paste-values-cs1" %}

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,27 @@ Please find the code to fetch the blob data and load it into the Spreadsheet com
160160
161161
{% previewsample "/document-processing/code-snippet/spreadsheet/react/open-from-blobdata-cs1" %}
162162
163+
### Load Workbook as JSON
164+
165+
The Spreadsheet component allows you to load an entire workbook using a JSON object. This JSON is typically generated by the Spreadsheet server by converting an Excel file into a Spreadsheet‑compatible workbook JSON, but it can also be created manually. When loaded, the component reads the JSON and restores all workbook details, including sheets, cells, styles, formulas, formatting, and other associated metadata.
166+
167+
You can optionally pass deserialization options to the [openFromJson](https://ej2.syncfusion.com/react/documentation/api/spreadsheet/index-default#openfromjson) method to ignore specific features when loading the JSON. For example, you can exclude styles, formulas, number formats, images, or conditional formatting. These options are optional—if you do not specify them, the method restores the full workbook details by default.
168+
169+
Reference: Guide to Creating the JSON Structure: https://help.syncfusion.com/document-processing/excel/spreadsheet/react/how-to/create-a-object-structure.
170+
171+
The following example demonstrates how to load a workbook JSON into the Spreadsheet component.
172+
173+
{% tabs %}
174+
{% highlight js tabtitle="app.jsx" %}
175+
{% include code-snippet/spreadsheet/react/open-from-json-cs1/app/app.jsx %}
176+
{% endhighlight %}
177+
{% highlight ts tabtitle="app.tsx" %}
178+
{% include code-snippet/spreadsheet/react/open-from-json-cs1/app/app.tsx %}
179+
{% endhighlight %}
180+
{% endtabs %}
181+
182+
{% previewsample "/document-processing/code-snippet/spreadsheet/react/open-from-json-cs1" %}
183+
163184
### Load server-side Excel files into Spreadsheet
164185
165186
By default, the Spreadsheet component provides an option to browse files from the local file system and open them within the component. If you want to load an Excel file located on a server, you need to configure the server endpoint to fetch the Excel file from the server location, process it using `Syncfusion.EJ2.Spreadsheet.AspNet.Core`, and send it back to the client side as `JSON data`. On the client side, you should use the [openFromJson](https://ej2.syncfusion.com/react/documentation/api/spreadsheet/index-default#openfromjson) method to load that `JSON data` into the Spreadsheet component.

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

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ Spreadsheet is a tabular format consisting of rows and columns. The intersection
1717

1818
## Insert
1919

20-
You can insert rows or columns anywhere in a spreadsheet. Use the [`allowInsert`](https://ej2.syncfusion.com/react/documentation/api/spreadsheet/#allowinsert) property to enable or disable the insert option in Spreadsheet.
20+
You can insert rows or columns anywhere in a spreadsheet. Use the [`allowInsert`](https://ej2.syncfusion.com/react/documentation/api/spreadsheet#allowinsert) property to enable or disable the insert option in Spreadsheet.
2121

2222
### Row
2323

2424
The rows can be inserted in the following ways,
2525

26-
* Using [`insertRow`](https://ej2.syncfusion.com/react/documentation/api/spreadsheet/#insertrow) method, you can insert the rows once the component is loaded.
26+
* Using [`insertRow`](https://ej2.syncfusion.com/react/documentation/api/spreadsheet#insertrow) method, you can insert the rows once the component is loaded.
2727
* Using context menu, insert the empty rows in the desired position.
2828

2929
The following code example shows the options for inserting rows in the spreadsheet.
@@ -49,7 +49,7 @@ The following code example shows the options for inserting rows in the spreadshe
4949

5050
The columns can be inserted in the following ways,
5151

52-
* Using [`insertColumn`](https://ej2.syncfusion.com/react/documentation/api/spreadsheet/#insertcolumn) method, you can insert the columns once the component is loaded.
52+
* Using [`insertColumn`](https://ej2.syncfusion.com/react/documentation/api/spreadsheet#insertcolumn) method, you can insert the columns once the component is loaded.
5353
* Using context menu, insert the empty columns in the desired position.
5454

5555
The following code example shows the options for inserting columns in the spreadsheet.
@@ -73,11 +73,11 @@ The following code example shows the options for inserting columns in the spread
7373

7474
## Delete
7575

76-
Delete support provides an option for deleting the rows and columns in the spreadsheet. Use [`allowDelete`](https://ej2.syncfusion.com/react/documentation/api/spreadsheet/#allowdelete) property to enable or disable the delete option in Spreadsheet.
76+
Delete support provides an option for deleting the rows and columns in the spreadsheet. Use [`allowDelete`](https://ej2.syncfusion.com/react/documentation/api/spreadsheet#allowdelete) property to enable or disable the delete option in Spreadsheet.
7777

7878
The rows and columns can be deleted dynamically in the following ways,
7979

80-
* Using [`delete`](https://ej2.syncfusion.com/react/documentation/api/spreadsheet/#delete) method, you can delete the loaded rows and columns.
80+
* Using [`delete`](https://ej2.syncfusion.com/react/documentation/api/spreadsheet#delete) method, you can delete the loaded rows and columns.
8181
* Using context menu, you can delete the selected rows and columns.
8282

8383
The following code example shows the delete operation of rows and columns in the spreadsheet.
@@ -149,11 +149,11 @@ The following code example shows the hide/show rows and columns operation in the
149149

150150
## Size
151151

152-
You can change the size of rows and columns in the spreadsheet by using [setRowsHeight](https://ej2.syncfusion.com/react/documentation/api/spreadsheet/#setrowsheight) and [setColumnsWidth](https://ej2.syncfusion.com/react/documentation/api/spreadsheet/#setcolumnswidth) methods.
152+
You can change the size of rows and columns in the spreadsheet by using [setRowsHeight](https://ej2.syncfusion.com/react/documentation/api/spreadsheet#setrowsheight) and [setColumnsWidth](https://ej2.syncfusion.com/react/documentation/api/spreadsheet#setcolumnswidth) methods.
153153

154154
### Row
155155

156-
You can change the height of single or multiple rows by using the [setRowsHeight](https://ej2.syncfusion.com/react/documentation/api/spreadsheet/#setrowsheight) method.
156+
You can change the height of single or multiple rows by using the [setRowsHeight](https://ej2.syncfusion.com/react/documentation/api/spreadsheet#setrowsheight) method.
157157

158158
You can provide the following type of ranges to the method:
159159

@@ -162,6 +162,8 @@ 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](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.
166+
165167
The following code example shows how to change the height for single/multiple rows in the spreadsheet.
166168

167169
{% tabs %}
@@ -183,7 +185,7 @@ The following code example shows how to change the height for single/multiple ro
183185

184186
### Column
185187

186-
You can change the width of single or multiple columns by using the [setColumnsWidth](https://ej2.syncfusion.com/react/documentation/api/spreadsheet/#setcolumnswidth) method.
188+
You can change the width of single or multiple columns by using the [setColumnsWidth](https://ej2.syncfusion.com/react/documentation/api/spreadsheet#setcolumnswidth) method.
187189

188190
You can provide the following type of ranges to the method:
189191

@@ -192,6 +194,8 @@ You can provide the following type of ranges to the method:
192194
* Multiple columns with discontinuous range: `['A:C', 'G:I', 'K:M']`
193195
* Multiple columns with different sheets: `[Sheet1!A:H, 'Sheet2!A:H', 'Sheet3!A:H']`
194196

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.
198+
195199
The following code example shows how to change the width for single/multiple columns in the spreadsheet.
196200

197201
{% tabs %}
@@ -213,7 +217,7 @@ The following code example shows how to change the width for single/multiple col
213217

214218
## Changing text in column headers
215219

216-
Using the [`beforeCellRender`](https://ej2.syncfusion.com/react/documentation/api/spreadsheet/#beforecellrender) event, you can change the text in the column headers. In that event, you can use the `e-header-cell` class to identify the header cell element and update its text value.
220+
Using the [`beforeCellRender`](https://ej2.syncfusion.com/react/documentation/api/spreadsheet#beforecellrender) event, you can change the text in the column headers. In that event, you can use the `e-header-cell` class to identify the header cell element and update its text value.
217221

218222
The following code example shows how to change the text in the column headers.
219223

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

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,25 @@ Please find below the code to retrieve blob data from the Spreadsheet control be
134134
135135
{% previewsample "/document-processing/code-snippet/spreadsheet/javascript-es6/save-as-blobdata-cs1" %}
136136
137+
### Save Workbook as JSON
138+
139+
Our Spreadsheet component allows you to export an entire workbook as a JSON object. This JSON output includes all workbook details such as sheets, cell values, formulas, styles, and formatting.
140+
141+
You can optionally pass serialization options to the [saveAsJson](https://ej2.syncfusion.com/react/documentation/api/spreadsheet/index-default#saveasjson) method to exclude specific features from the exported JSON. For example, you can choose to ignore styles, formulas, number formats, images, or conditional formatting. These options are fully optional—if they are not provided, the method exports the workbook with all details preserved by default.
142+
143+
The following example demonstrates how to save a workbook as JSON from the Spreadsheet component.
144+
145+
{% tabs %}
146+
{% highlight js tabtitle="app.jsx" %}
147+
{% include code-snippet/spreadsheet/react/save-as-json-cs1/app/app.jsx %}
148+
{% endhighlight %}
149+
{% highlight ts tabtitle="app.tsx" %}
150+
{% include code-snippet/spreadsheet/react/save-as-json-cs1/app/app.tsx %}
151+
{% endhighlight %}
152+
{% endtabs %}
153+
154+
{% previewsample "/document-processing/code-snippet/spreadsheet/react/save-as-json-cs1" %}
155+
137156
### Save Excel files to a server
138157
139158
By default, the Spreadsheet control saves the Excel file and downloads it to the local file system. If you want to save an Excel file to a server location, you need to configure the server endpoint to convert the spreadsheet data into a file stream and save it to the server location. To do this, first, on the client side, you must convert the spreadsheet data into `JSON` format using the [saveAsJson](https://ej2.syncfusion.com/documentation/api/spreadsheet/index-default#saveasjson) method and send it to the server endpoint. On the server endpoint, you should convert the received spreadsheet `JSON` data into a file stream using `Syncfusion.EJ2.Spreadsheet.AspNet.Core`, then convert the stream into an Excel file, and finally save it to the server location.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import * as React from 'react';
2+
import { createRoot } from 'react-dom/client';
3+
import { SpreadsheetComponent } from '@syncfusion/ej2-react-spreadsheet';
4+
import { jsonData } from './datasource';
5+
6+
function App() {
7+
const spreadsheetRef = React.useRef(null);
8+
9+
const handleOpenFromJson = React.useCallback(() => {
10+
if (!spreadsheetRef.current) return;
11+
spreadsheetRef.current.openFromJson({ file: jsonData });
12+
}, []);
13+
14+
return (
15+
<div className="control-pane">
16+
<div className="control-section spreadsheet-control">
17+
<div style={{ padding: '8px 0' }}>
18+
<button className="e-btn e-primary" onClick={handleOpenFromJson}>
19+
Load workbook JSON
20+
</button>
21+
</div>
22+
<div>
23+
<SpreadsheetComponent id="spreadsheet" ref={spreadsheetRef} />
24+
</div>
25+
</div>
26+
</div>
27+
);
28+
}
29+
30+
export default App;
31+
32+
const root = createRoot(document.getElementById('root'));
33+
root.render(<App />);
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import * as React from 'react';
2+
import { createRoot } from 'react-dom/client';
3+
import { SpreadsheetComponent } from '@syncfusion/ej2-react-spreadsheet';
4+
import { jsonData } from './datasource';
5+
6+
function App(): React.ReactElement {
7+
const spreadsheetRef = React.useRef<SpreadsheetComponent | null>(null);
8+
9+
const handleOpenFromJson = React.useCallback((): void => {
10+
if (!spreadsheetRef.current) return;
11+
spreadsheetRef.current.openFromJson({ file: jsonData });
12+
}, []);
13+
14+
return (
15+
<div className="control-pane">
16+
<div className="control-section spreadsheet-control">
17+
<div style={{ padding: '8px 0' }}>
18+
<button className="e-btn e-primary" onClick={handleOpenFromJson}>
19+
Load workbook JSON
20+
</button>
21+
</div>
22+
<div>
23+
<SpreadsheetComponent id="spreadsheet" ref={spreadsheetRef} />
24+
</div>
25+
</div>
26+
</div>
27+
);
28+
}
29+
30+
export default App;
31+
32+
const root = createRoot(document.getElementById('root')!);
33+
root.render(<App />);

0 commit comments

Comments
 (0)