title: Problems on loading Excel 2007 file into WebBrowser control in C#?
body: <p>I need to host Excel spreadsheet in our WinForms app. It looks loading the excel file into WebBrowser control is the way to go. There are several articles on the Internet about this. However, they mostly use Excel 2003 (I guess). Excel 2007 presents some new problems:</p>
  
  <ol>
  <li><p>By default, the Excel spreadsheet is opened up in a new window, instead of embedded in my WebBrowser control. Base on Microsoft, this is by design, but it also suggests a fix by changing the registry settings. This is not great, but I can probably live with that.</p></li>
  <li><p>With that registry change, I was able to embed the Excel spreadsheet in my WebBrowser control. However, the Excel Workbook is still open in background - which I can't even close, but is closed automatically when my WinForm app is closed. It is interesting when you watch how the spreadsheet gets loaded: it's loaded into the Excel workbook (in background) first and then transfered into my WebBrowser control. How can I get rid (or hide) of this background window? 
  EDIT: Actually, the Excel window is not closed, but put into background. However, with help from <a href="http://www.codeproject.com/KB/office/Embedding_Excel.aspx" rel="nofollow">this article</a> at CodeProject, it can be closed. In that article, the Excel window is closed when WinApp is closed. But the same function can be used to close that window on WebBrowser's DocumentCompleted event. It's not perfect becuase you still see a screen flash, but it's okay. I wish there is a better way to do it. To avoid screen flashes, I tried to just minimize the Excel window. However, when I try to set the WindowState to Minimized, it throws a COM exception. Any clue? It would be a better workaround if I could hide this disabled window from beginning.</p></li>
  <li><p>When you open a spreadsheet first time, a messgebox pops up asking you for options to "Open", "Save", and "Cancel". There is a checkbox to disable it. But I don't want this messagebox ever show up. What is the registry setting for this?</p></li>
  <li><p>In my spreadsheet, there is an add-in component which should be loaded dynamically. However, loading it to WebBrowser doesn't work (it can't find it). If I make the add-in active, it loads without problem. Is there anything on WebBrowser to be changed to make it work?</p></li>
  </ol>
  
  <p>Are there better alternatives to host Excel spreadsheet in WinForms app?</p>