Skip to content

Commit 142f5cf

Browse files
committed
Merge branch 'development' of https://github.com/syncfusion-content/document-processing-docs into EJ2-1011961-ug
2 parents 4564440 + 428b594 commit 142f5cf

23 files changed

Lines changed: 1154 additions & 55 deletions

File tree

Document-Processing-toc.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5331,6 +5331,10 @@
53315331
<li><a href="/document-processing/excel/spreadsheet/react/how-to/create-a-object-structure">Create a object structure </a></li>
53325332
<li><a href="/document-processing/excel/spreadsheet/react/how-to/change-active-sheet">Changing the active sheet while importing a file</a></li>
53335333
<li><a href="/document-processing/excel/spreadsheet/react/how-to/identify-the-context-menu-opened">Identify the context menu opened</a></li>
5334+
<li><a href="/document-processing/excel/spreadsheet/react/how-to/find-replace-in-range">Find and replace the text within the selected range of cells</a></li>
5335+
<li><a href="/document-processing/excel/spreadsheet/react/how-to/add-dynamic-cell-template">Add dynamic cell templates</a></li>
5336+
<li><a href="/document-processing/excel/spreadsheet/react/how-to/add-cell-icon">Add an icon to the cell</a></li>
5337+
<li><a href="/document-processing/excel/spreadsheet/react/how-to/get-filtered-data">Get the filtered row data</a></li>
53345338
</ul>
53355339
</li>
53365340
<li><a href="/document-processing/excel/spreadsheet/react/mobile-responsiveness">Mobile Responsiveness</a></li>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
layout: post
3+
title: Add icons inside cells in React Spreadsheet component | Syncfusion
4+
description: Learn here all about adding icon inside cells using a custom template 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+
# Add Custom Icons to Cells in React Spreadsheet
11+
12+
In the Syncfusion Spreadsheet, you can render custom icons inside specific cells by defining a custom template property within the cell model. During the [beforeCellRender](https://ej2.syncfusion.com/react/documentation/api/spreadsheet/index-default#beforecellrender) event, the icon element can be appended to the corresponding table cell (td) by checking whether the cell contains this template property.
13+
14+
The following sample demonstrates how to add icons to cells by assigning the template property in the cell definition. Additionally, a custom ribbon item named "Add Icon" is included under a new "Template" ribbon tab. When this ribbon item is selected, the Spreadsheet dynamically inserts an icon into the currently active cell.
15+
16+
{% tabs %}
17+
{% highlight js tabtitle="app.jsx" %}
18+
{% include code-snippet/spreadsheet/react/add-icon-in-cell-cs1/app/app.jsx %}
19+
{% endhighlight %}
20+
{% highlight ts tabtitle="app.tsx" %}
21+
{% include code-snippet/spreadsheet/react/add-icon-in-cell-cs1/app/app.tsx %}
22+
{% endhighlight %}
23+
{% endtabs %}
24+
25+
{% previewsample "/document-processing/code-snippet/spreadsheet/react/add-icon-in-cell-cs1" %}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
layout: post
3+
title: Dynamic cell template in React Spreadsheet component | Syncfusion
4+
description: Render dropdown templates inside cells 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+
# Create Dynamic Cell Templates with Dropdowns in React Spreadsheet
11+
12+
You can add templates to cells in the Syncfusion Spreadsheet component by dynamically assigning a custom template property directly to individual cells. When a cell has this custom template property, you can use the [beforeCellRender](https://ej2.syncfusion.com/react/documentation/api/spreadsheet/index-default#beforecellrender) event to append the desired template element to the cell.
13+
14+
The following sample demonstrates how to insert a [Syncfusion Dropdown component](https://www.npmjs.com/package/@syncfusion/ej2-dropdowns) into Spreadsheet cells using this custom template property. Additionally, a custom ribbon item named "DropDown List" is included under a new "Template" ribbon tab. When this ribbon item is selected, the Spreadsheet dynamically inserts a dropdown into the currently active cell.
15+
16+
{% tabs %}
17+
{% highlight js tabtitle="app.jsx" %}
18+
{% include code-snippet/spreadsheet/react/dynamic-cell-template-cs1/app/app.jsx %}
19+
{% endhighlight %}
20+
{% highlight ts tabtitle="app.tsx" %}
21+
{% include code-snippet/spreadsheet/react/dynamic-cell-template-cs1/app/app.tsx %}
22+
{% endhighlight %}
23+
{% endtabs %}
24+
25+
{% previewsample "/document-processing/code-snippet/spreadsheet/react/dynamic-cell-template-cs1" %}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
layout: post
3+
title: Find and replace in range in React Spreadsheet component | Syncfusion
4+
description: Learn here all about performing find and replace limited to the range 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+
# Find and replace the text within the selected range of cells
11+
12+
In Syncfusion Spreadsheet, the "Replace All" action by default searches and replaces a text throughout the entire sheet, regardless of the selected range. To limit "Replace All" to only the selected range, you can customize the addressCollection based on the selectedRange in the [actionBegin](https://ej2.syncfusion.com/documentation/api/spreadsheet/index-default#actionbegin) event when the action is `beforeReplaceAll`.
13+
14+
The following sample demonstrates how to limit the "Replace All" operation to the currently selected range.
15+
16+
{% tabs %}
17+
{% highlight js tabtitle="app.jsx" %}
18+
{% include code-snippet/spreadsheet/react/find-and-replace-cs1/app/app.jsx %}
19+
{% endhighlight %}
20+
{% highlight ts tabtitle="app.tsx" %}
21+
{% include code-snippet/spreadsheet/react/find-and-replace-cs1/app/app.tsx %}
22+
{% endhighlight %}
23+
{% endtabs %}
24+
25+
{% previewsample "/document-processing/code-snippet/spreadsheet/react/find-and-replace-cs1" %}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
layout: post
3+
title: Retrieve filtered row data in React Spreadsheet component | Syncfusion
4+
description: Learn here all about getting filtered row data 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+
# Get filtered row data in React Spreadsheet
11+
12+
Filtering in the Syncfusion Spreadsheet allows you to display only the rows that match your criteria, hiding all others. You can enable filtering by setting the [allowFiltering](https://ej2.syncfusion.com/react/documentation/api/spreadsheet/index-default#allowfiltering) property, and apply filters either through the UI or programmatically using the [applyFilter](https://ej2.syncfusion.com/react/documentation/api/spreadsheet/index-default#applyfilter) method. To identify which rows are filtered, iterate through the sheet's row collection and check the `isFiltered` property of each row object. This flag indicates whether a row is currently hidden due to filtering.
13+
14+
The following example shows how to get the filtered rows from the Spreadsheet:
15+
16+
{% tabs %}
17+
{% highlight js tabtitle="app.jsx" %}
18+
{% include code-snippet/spreadsheet/react/filter-cs2/app/app.jsx %}
19+
{% endhighlight %}
20+
{% highlight ts tabtitle="app.tsx" %}
21+
{% include code-snippet/spreadsheet/react/filter-cs2/app/app.tsx %}
22+
{% endhighlight %}
23+
{% highlight js tabtitle="datasource.jsx" %}
24+
{% include code-snippet/spreadsheet/react/filter-cs2/app/datasource.jsx %}
25+
{% endhighlight %}
26+
{% highlight ts tabtitle="datasource.tsx" %}
27+
{% include code-snippet/spreadsheet/react/filter-cs2/app/datasource.tsx %}
28+
{% endhighlight %}
29+
{% endtabs %}
30+
31+
{% previewsample "/document-processing/code-snippet/spreadsheet/react/filter-cs2" %}

Document-Processing/Excel/Spreadsheet/React/Open-Excel-File/from-google-drive.md renamed to Document-Processing/Excel/Spreadsheet/React/open-excel-file/from-google-drive.md

File renamed without changes.

Document-Processing/Excel/Spreadsheet/React/Save-Excel-File/to-google-drive.md renamed to Document-Processing/Excel/Spreadsheet/React/save-excel-file/to-google-drive.md

File renamed without changes.

Document-Processing/ai-coding-assistant/prompt-library.md

Lines changed: 29 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -230,74 +230,50 @@ The Syncfusion PowerPoint Library enables developers to create, read, edit, and
230230

231231
The Syncfusion Spreadsheet Editor SDK component enables developers to create, view, edit, and analyze spreadsheets directly in web and desktop applications across multiple platforms, including Angular, React, Vue, JavaScript, Blazor, ASP.NET Core, and more.
232232

233-
{% tabs %}
234-
{% highlight tabtitle="Initialize Spreadsheet" %}
233+
{% promptcards %}
234+
{% promptcard Initialize Spreadsheet %}
235235
#SyncfusionSpreadsheetEditorSDKAssistant How do I initialize a basic Spreadsheet in Angular with default settings?
236-
{% endhighlight %}
237-
{% endtabs %}
238-
{% tabs %}
239-
{% highlight tabtitle="Data Binding" %}
236+
{% endpromptcard %}
237+
{% promptcard Data Binding %}
240238
#SyncfusionSpreadsheetEditorSDKAssistant Show me how to bind local JSON data to the Spreadsheet in React?
241-
{% endhighlight %}
242-
{% endtabs %}
243-
{% tabs %}
244-
{% highlight tabtitle="Remote Data Binding" %}
239+
{% endpromptcard %}
240+
{% promptcard Remote Data Binding %}
245241
#SyncfusionSpreadsheetEditorSDKAssistant Provide an example of binding remote data in a Vue Spreadsheet?
246-
{% endhighlight %}
247-
{% endtabs %}
248-
{% tabs %}
249-
{% highlight tabtitle="Formulas and Calculation" %}
242+
{% endpromptcard %}
243+
{% promptcard Formulas and Calculation %}
250244
#SyncfusionSpreadsheetEditorSDKAssistant How can I enable formula support and use named ranges in the TypeScript Spreadsheet?
251-
{% endhighlight %}
252-
{% endtabs %}
253-
{% tabs %}
254-
{% highlight tabtitle="Charts" %}
245+
{% endpromptcard %}
246+
{% promptcard Charts %}
255247
#SyncfusionSpreadsheetEditorSDKAssistant How do I insert and customize a column chart in the Blazor Spreadsheet?
256-
{% endhighlight %}
257-
{% endtabs %}
258-
{% tabs %}
259-
{% highlight tabtitle="Data Validation" %}
248+
{% endpromptcard %}
249+
{% promptcard Data Validation %}
260250
#SyncfusionSpreadsheetEditorSDKAssistant Provide an example of adding list validation to cells in TypeScript?
261-
{% endhighlight %}
262-
{% endtabs %}
263-
{% tabs %}
264-
{% highlight tabtitle="Import and Export" %}
251+
{% endpromptcard %}
252+
{% promptcard Import and Export %}
265253
#SyncfusionSpreadsheetEditorSDKAssistant How do I import an Excel file and export the Spreadsheet as XLSX in ASP.NET Core?
266-
{% endhighlight %}
267-
{% endtabs %}
268-
{% tabs %}
269-
{% highlight tabtitle="Ribbon and Toolbar" %}
254+
{% endpromptcard %}
255+
{% promptcard Ribbon and Toolbar %}
270256
#SyncfusionSpreadsheetEditorSDKAssistant Show how to customize the ribbon toolbar and add custom buttons in the ASP.NET MVC Spreadsheet?
271-
{% endhighlight %}
272-
{% endtabs %}
273-
{% tabs %}
274-
{% highlight tabtitle="Grid Lines and Headers" %}
257+
{% endpromptcard %}
258+
{% promptcard Grid Lines and Headers %}
275259
#SyncfusionSpreadsheetEditorSDKAssistant How do I show or hide grid lines and row/column headers in the Windows Forms Spreadsheet?
276-
{% endhighlight %}
277-
{% endtabs %}
278-
{% tabs %}
279-
{% highlight tabtitle="Sheet Protection" %}
260+
{% endpromptcard %}
261+
{% promptcard Sheet Protection %}
280262
#SyncfusionSpreadsheetEditorSDKAssistant How can I protect a sheet with a password in the WPF Spreadsheet control?
281-
{% endhighlight %}
282-
{% endtabs %}
283-
{% tabs %}
284-
{% highlight tabtitle="Conditional Formatting" %}
263+
{% endpromptcard %}
264+
{% promptcard Conditional Formatting %}
285265
#SyncfusionSpreadsheetEditorSDKAssistant How do I apply conditional formatting such as color scales or data bars in the UWP Spreadsheet?
286-
{% endhighlight %}
287-
{% endtabs %}
288-
{% tabs %}
289-
{% highlight tabtitle="Cell Formatting" %}
266+
{% endpromptcard %}
267+
{% promptcard Cell Formatting %}
290268
#SyncfusionSpreadsheetEditorSDKAssistant How do I apply cell styles, number formatting, and wrap text in the TypeScript Spreadsheet?
291-
{% endhighlight %}
292-
{% endtabs %}
293-
{% tabs %}
294-
{% highlight tabtitle="Sorting and Filtering" %}
269+
{% endpromptcard %}
270+
{% promptcard Sorting and Filtering %}
295271
#SyncfusionSpreadsheetEditorSDKAssistant Show me how to enable sorting and filtering features in the React Spreadsheet?
296-
{% endhighlight %}
297-
{% endtabs %}
272+
{% endpromptcard %}
273+
{% endpromptcards %}
298274

299275
## See also
300276

301277
* [AI Coding Assistant Overview](https://help.syncfusion.com/document-processing/ai-coding-assistant/overview)
302278
* [SyncfusionDocumentSDKAssistant MCP Server](https://www.npmjs.com/package/@syncfusion/documentsdk-assistant)
303-
* [SyncfusionSpreadsheetEditorSDKAssistant MCP Server](https://www.npmjs.com/package/@syncfusion/spreadsheeteditorsdk-assistant)
279+
* [SyncfusionSpreadsheetEditorSDKAssistant MCP Server](https://www.npmjs.com/package/@syncfusion/spreadsheeteditorsdk-assistant)
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
import React, { useRef } from 'react';
2+
import { createRoot } from 'react-dom/client';
3+
import { SpreadsheetComponent } from '@syncfusion/ej2-react-spreadsheet';
4+
5+
function App() {
6+
const spreadsheetRef = useRef(null);
7+
8+
// To create plus icon wrapper.
9+
const createPlusIconWrapper = () => {
10+
const wrapperDiv = document.createElement('div');
11+
wrapperDiv.className = 'e-custom-wrapper';
12+
const iconSpan = document.createElement('span');
13+
iconSpan.className = 'e-icons e-plus e-custom-icon';
14+
wrapperDiv.appendChild(iconSpan);
15+
return wrapperDiv;
16+
};
17+
18+
// Triggers after the component is created
19+
const handleCreated = () => {
20+
if (!spreadsheetRef.current) return;
21+
// Initialize icons in the cells when the spreadsheet loads.
22+
spreadsheetRef.current.updateCell({ template: 'plus-icon' }, 'A1');
23+
spreadsheetRef.current.updateCell({ template: 'plus-icon' }, 'B1');
24+
spreadsheetRef.current.updateCell({ template: 'plus-icon' }, 'C1');
25+
spreadsheetRef.current.resize();
26+
// This is to Add a header Ribbon tab with a button to initialize everything on click.
27+
spreadsheetRef.current.addRibbonTabs([
28+
{
29+
header: { text: 'Template' },
30+
content: [
31+
{
32+
text: 'Add Icon',
33+
tooltipText: 'Initialize',
34+
click: () => {
35+
if (!spreadsheetRef.current) return;
36+
// Add the plus icon template to the selected cell
37+
const sheet = spreadsheetRef.current.getActiveSheet();
38+
spreadsheetRef.current.updateCell({ template: 'plus-icon' }, sheet.activeCell);
39+
spreadsheetRef.current.resize();
40+
},
41+
},
42+
],
43+
},
44+
]);
45+
};
46+
47+
// Triggers before the cell is appended to DOM
48+
const handleBeforeCellRender = (args) => {
49+
if (args.cell && args.cell.template === 'plus-icon') {
50+
// Pass the rowIndex to the wrapper to make the click handler reliable.
51+
const wrapperDiv = createPlusIconWrapper();
52+
args.element.insertBefore(wrapperDiv, args.element.firstChild);
53+
}
54+
};
55+
56+
return (
57+
<div>
58+
<SpreadsheetComponent
59+
ref={spreadsheetRef}
60+
created={handleCreated}
61+
beforeCellRender={handleBeforeCellRender}
62+
/>
63+
</div>
64+
);
65+
}
66+
67+
const root = createRoot(document.getElementById('root'));
68+
root.render(<App />);
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
import React, { useRef } from 'react';
2+
import { createRoot } from 'react-dom/client';
3+
import { SpreadsheetComponent } from '@syncfusion/ej2-react-spreadsheet';
4+
5+
function App(): React.ReactElement {
6+
const spreadsheetRef = useRef<SpreadsheetComponent | null>(null);
7+
8+
// To create plus icon wrapper.
9+
const createPlusIconWrapper = (): HTMLElement => {
10+
const wrapperDiv: HTMLDivElement = document.createElement('div');
11+
wrapperDiv.className = 'e-custom-wrapper';
12+
const iconSpan: HTMLSpanElement = document.createElement('span');
13+
iconSpan.className = 'e-icons e-plus e-custom-icon';
14+
wrapperDiv.appendChild(iconSpan);
15+
return wrapperDiv;
16+
};
17+
18+
// Triggers after the component is created
19+
const handleCreated = (): void => {
20+
if (!spreadsheetRef.current) return;
21+
// Initialize icons in the cells when the spreadsheet loads.
22+
spreadsheetRef.current.updateCell({ template: 'plus-icon' } as any, 'A1');
23+
spreadsheetRef.current.updateCell({ template: 'plus-icon' } as any, 'B1');
24+
spreadsheetRef.current.updateCell({ template: 'plus-icon' } as any, 'C1');
25+
spreadsheetRef.current.resize();
26+
// This is to Add a header Ribbon tab with a button to initialize everything on click.
27+
spreadsheetRef.current.addRibbonTabs([
28+
{
29+
header: { text: 'Template' },
30+
content: [
31+
{
32+
text: 'Add Icon',
33+
tooltipText: 'Initialize',
34+
click: () => {
35+
if (!spreadsheetRef.current) return;
36+
// Add the plus icon template to the selected cell
37+
const sheet: any = spreadsheetRef.current.getActiveSheet();
38+
spreadsheetRef.current.updateCell({ template: 'plus-icon' } as any, (sheet as any).activeCell);
39+
spreadsheetRef.current.resize();
40+
},
41+
},
42+
],
43+
},
44+
]);
45+
};
46+
47+
// Triggers before the cell is appended to DOM
48+
const handleBeforeCellRender = (args: any) => {
49+
if (args.cell && args.cell.template === 'plus-icon') {
50+
// Pass the rowIndex to the wrapper to make the click handler reliable.
51+
const wrapperDiv: HTMLElement = createPlusIconWrapper();
52+
args.element.insertBefore(wrapperDiv, args.element.firstChild);
53+
}
54+
};
55+
56+
return (
57+
<div>
58+
<SpreadsheetComponent
59+
ref={spreadsheetRef}
60+
created={handleCreated}
61+
beforeCellRender={handleBeforeCellRender}
62+
/>
63+
</div>
64+
);
65+
}
66+
67+
export default App;
68+
69+
const root = createRoot(document.getElementById('root')!);
70+
root.render(<App />);

0 commit comments

Comments
 (0)