How to open the Excel(.xlsx) file embeded in Windo

2019-07-22 08:01发布

I am trying to display the Excel document in windows forms using the webbrowser Control.

Using the code googled in Codeproject How to Integrate Excel in a Windows Form Application using the WebBrowser[^] and i am able to disaply excel(.xls and .xlsx) files in 32 bit Operating System correctly in webbrowser control.

But when i trying to execute the code in 64-bit operating system .xlsx type Excel files didn't open in webbrowser Control instead they were opening as normal excel file but .xls files opening correctly in webbrowser Control. For that i executed the register Script to change the registry settings using the below link A new window opens when you try to view a 2007 Microsoft Office program document in IE7 or IE8 but .xlsx files always Open separately as like Office excel file instead of opening it in webbrowser Controls.

Presently i am using Microsoft Office 2010 software as my office tool.

Please provide the solution to open the .xlsx files to be open in webbrowser control.

标签: c# excel browser
1条回答
欢心
2楼-- · 2019-07-22 09:04

To be able to embed Office in a 64 bit process you need 64 bit Office installed. That means you can't have 32 bit Office (they can't coexist on the same machine) and your 32 bit program won't work. You can ship two editions, one x86 and one x64) and let the user to make the choice, or ship both and start the correct edition with a launcher that detects the CPU bitness.

By the way, you still need the BrowserFlags hack as what you are doing is discouraged by Microsoft since 2007. While Office 2010 still has ActiveX Document Server support, the Office team will remove the support at some point in the future. So if you are depending on the Office's ActiveX Document Server support as a core feature, you need to plan ahead.

查看更多
登录 后发表回答