Search code examples
spreadsheetgear

How to show Find/Replace Dialog on SpreadsheetGear workbook?


How can I show from code SpreadsheetGear dialogs like Find/Replace?

There is WorkbookDesigner form which has most of those dialogs in main menu, but how can I implement it myself?


Solution

  • The "Find and Replace" dialog is not part of SpreadsheetGear's public API and so cannot be instantiated from code. Developers using Windows Forms have been able to "hack" this since a keyboard shortcut does exist to launch this dialog from the WinForms WorkbookView. This has been done by sending a Ctrl+F keystroke to the WorkbookView, using something like the following:

    workbookView.Focus();
    System.Windows.Forms.SendKeys.Send("^f");
    

    WPF doesn't support this model since it is part of Windows Forms. However, it appears that using System.Windows.Forms.SendKeys.SendWait("^f") might work instead, but I make no guarantees of this.

    Generally speaking, if a particular "dialog", such as the Find and Replace dialog, is not listed in the SpreadsheetGear.Windows.Forms namespace, then it is not available to instantiate from code.