2

I am trying below tiny code to embed excel inside my Winform application.

 string mySheet = @"C:\Apps\source\repos\TestApp\TestSheet.xlsx";
            webBrowser1.Navigate(mySheet, false);

But my issue is that excel is popping out of the WinForm application, in order to stop that I required to modify registry value "BrowserFlags" to 0 on a path: Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Excel.Sheet.12

My question is that how to avoid any registry modification or any modification which require admin privileges.

  • https://www.google.com/search?q=WebBrowser+excel+embed+c%23+site%3Astackoverflow.com&oq=WebBrowser+excel+embed+c%23+site%3Astackoverflow.com – Loathing Jan 27 '21 at 07:16
  • Why don't you parent the Excel Window to a ContainerControl, as show here: [Unhook Window into its original State](https://stackoverflow.com/a/65847818/7444103). Btw, I doubt that, even if it works with the Registry setting, Excel can find the file with a Path formatted like that: it will truncate at the first space in the Path string. Not the main issue, but still... Note that, also in this case, you have a problem if the User closes the Excel Window using its Close Button. – Jimi Jan 27 '21 at 09:39

0 Answers0