Use the Find / replace dialog from code

3 Answers 46 Views
Spreadsheet
Ian
Top achievements
Rank 2
Bronze
Iron
Iron
Ian asked on 27 Jul 2023, 11:04 AM

Is there any way to invoke the 'Find replace' dialog from within code? I get that all of the methods which do the finding and replacing are available in the API, but I don't really want to re-implement your UI.

Associated question - is it possible to re-use individual menu items from within your RadSpreadsheetRibbonBar? So just copying your 'find' menu item?

Problem is that I only want otthe user to have the 'find' option under specific circumstances.

Thanks

3 Answers, 1 is accepted

Sort by
0
Dinko | Tech Support Engineer
Telerik team
answered on 01 Aug 2023, 09:11 AM

Hi Ian,

The replace and find methods are available in the Workbook property. Check the following code snippet:

this.radSpreadsheet1.Workbook.Replace(new ReplaceOptions());
this.radSpreadsheet1.Workbook.ReplaceAll(new ReplaceOptions());
this.radSpreadsheet1.Workbook.Find(new FindOptions());
this.radSpreadsheet1.Workbook.FindAll(new FindOptions());

You can create your own ReplaceOptions/FindOptions parameter depending on your requirement.

As for your second question, I am not sure what you mean by re-use. If you want only some users to have the find option in the ribbon, you could hide the button. The following code snippet demonstrates how to navigate to it and set its Visibility property to Visible/Collapsed.

var homeTab = this.radSpreadsheetRibbonBar1.CommandTabs[0] as RibbonTab;
var editingGroup = homeTab.Items.Last as RadRibbonBarGroup;
editingGroup.Items.Last.Visibility = ElementVisibility.Collapsed;

Give it a try and let me know if the above suggestions are working for you.

Regards,
Dinko | Tech Support Engineer
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

0
Ian
Top achievements
Rank 2
Bronze
Iron
Iron
answered on 01 Aug 2023, 09:33 AM

Thanks for this - I have replicated your UI, and used the functions you provided above.

The reason I can't just use the items in your ribbon bar is because i'm not using your ribbon bar. Firstly because it's very, very slow to load (~5-6 sec) and secondly, it has lots of options which I can't let my users use, because they would make a mess of a highly-formatted sheet.

Thanks

0
Dinko | Tech Support Engineer
Telerik team
answered on 01 Aug 2023, 12:38 PM

Hi Ian,

You can hide the different options in the RadSpreadsheetRibbonBar using a similar approach in my previous reply which hides the Find button. Every option in the RadSpreadsheetRibbonBar can be used programmatically. If you want to use a similar option in your custom ribbon, you can create a custom form similar to Find and Replace form. When the user types his settings, you can get them and use one of the Replace/Find methods. The dialogs in the RadSpreadsheetRibbonBar dialogs are coupled with the control and can't be used standalone.

Regards,
Dinko | Tech Support Engineer
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Spreadsheet
Asked by
Ian
Top achievements
Rank 2
Bronze
Iron
Iron
Answers by
Dinko | Tech Support Engineer
Telerik team
Ian
Top achievements
Rank 2
Bronze
Iron
Iron
Share this question
or