search and replace in Spreadsheet

1 Answer 111 Views
Spreadsheet
serge
Top achievements
Rank 2
Bronze
Iron
Iron
serge asked on 24 May 2022, 01:48 PM

Our customers using the spreadsheet copy/paste values in the Spreadsheet (ASP. NET CORE)

 

Sometimes pasted decimal separator is ".", sometimes is the ",".

Is there a way to search and replace the pasted values from "," to ".", or, if not, to search and replace in Spreadsheet ?

1 Answer, 1 is accepted

Sort by
1
Accepted
Aleksandar
Telerik team
answered on 27 May 2022, 07:00 AM

Hello Serge,

Currently the Spreadsheet does not provide a search functionality, however there is a Feature Request for providing support for searching. If this matches your requirement I will urge you to vote on it. If not you may submit a Feature Request, providing as many details as possible, so we can monitor the community interest in the requested feature and consider it for future implementation.

That said, with the current implementation there is a client-side paste event exposed for the Spreadsheet. The event provides reference to the clipboardContent object, representing the content that has been passed from the clipboard to the paste command. This data allows you to prevent the default execution of the paste functionality, manipulate the data and paste it properly in the widget content. You can, for example, add an event handler and replace the comma with a dot:

function onPaste(arg) { 
          arg.clipboardContent.data = arg.clipboardContent.data.map(function (row) {
                return row.map(function (cell) {
                    return {...cell, value: cell.value.replace(",",".")}
                });
            });
        }

Here is a dojo example. Feel free to modify the above suggestion to meet the requirements you have.

Regards,
Aleksandar
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Spreadsheet
Asked by
serge
Top achievements
Rank 2
Bronze
Iron
Iron
Answers by
Aleksandar
Telerik team
Share this question
or