You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<li><a href="/document-processing/excel/spreadsheet/react/how-to/add-cell-icon">Add an icon to the cell</a></li>
5457
5457
<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>
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 %}
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 %}
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.
Copy file name to clipboardExpand all lines: Document-Processing/Excel/Spreadsheet/React/rows-and-columns.md
+13-9Lines changed: 13 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,13 +17,13 @@ Spreadsheet is a tabular format consisting of rows and columns. The intersection
17
17
18
18
## Insert
19
19
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.
21
21
22
22
### Row
23
23
24
24
The rows can be inserted in the following ways,
25
25
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.
27
27
* Using context menu, insert the empty rows in the desired position.
28
28
29
29
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
49
49
50
50
The columns can be inserted in the following ways,
51
51
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.
53
53
* Using context menu, insert the empty columns in the desired position.
54
54
55
55
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
73
73
74
74
## Delete
75
75
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.
77
77
78
78
The rows and columns can be deleted dynamically in the following ways,
79
79
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.
81
81
* Using context menu, you can delete the selected rows and columns.
82
82
83
83
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
149
149
150
150
## Size
151
151
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.
153
153
154
154
### Row
155
155
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.
157
157
158
158
You can provide the following type of ranges to the method:
159
159
@@ -162,6 +162,8 @@ You can provide the following type of ranges to the method:
162
162
* Multiple rows with discontinuous range: `['1:10', '15:25', '30:40']`
163
163
* Multiple rows with different sheets: `[Sheet1!1:50, 'Sheet2!1:50', 'Sheet3!1:50']`
164
164
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
+
165
167
The following code example shows how to change the height for single/multiple rows in the spreadsheet.
166
168
167
169
{% tabs %}
@@ -183,7 +185,7 @@ The following code example shows how to change the height for single/multiple ro
183
185
184
186
### Column
185
187
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.
187
189
188
190
You can provide the following type of ranges to the method:
189
191
@@ -192,6 +194,8 @@ You can provide the following type of ranges to the method:
192
194
* Multiple columns with discontinuous range: `['A:C', 'G:I', 'K:M']`
193
195
* Multiple columns with different sheets: `[Sheet1!A:H, 'Sheet2!A:H', 'Sheet3!A:H']`
194
196
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
+
195
199
The following code example shows how to change the width for single/multiple columns in the spreadsheet.
196
200
197
201
{% tabs %}
@@ -213,7 +217,7 @@ The following code example shows how to change the width for single/multiple col
213
217
214
218
## Changing text in column headers
215
219
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.
217
221
218
222
The following code example shows how to change the text in the column headers.
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 %}
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.
0 commit comments