如何在64位操作系统中打开嵌入在Windowforms控件中的Excel(.xlsx)文件 [英] How to open the Excel(.xlsx) file embeded in Windowforms control in 64 bit OS

查看:120
本文介绍了如何在64位操作系统中打开嵌入在Windowforms控件中的Excel(.xlsx)文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Webbrowser控件在Windows窗体中显示Excel文档。

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

在Codeproject中使用Google代码搜索如何使用Windows将Excel集成到Windows窗体应用程序中WebBrowser [^],我能够在webbrowser控件中正确显示32位操作系统中的excel(.xls和.xlsx)文件。

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.

但是当我尝试在64位操作系统中执行代码。.xlsx类型Excel文件未在webbrowser Control中打开,而是以普通excel文件形式打开,但.xls文件在webbrowser Control中正确打开。为此,我执行了注册脚本,使用以下链接来更改注册表设置,当您尝试在IE7或IE8中查看2007 Microsoft Office程序文档时会打开一个新窗口,但是.xlsx文件始终像Office excel文件一样单独打开而不是打开

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.

目前我正在使用Microsoft Office 2010软件作为我的办公工具。

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

请提供打开 .xlsx 文件以在Web浏览器控件中打开的解决方案。

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

推荐答案

要能够在64位进程中嵌入Office,您需要安装64位Office。这意味着您不能拥有32位Office(它们不能在同一台计算机上共存),并且您的32位程序将无法正常工作。您可以发布两个版本,一个x86和一个x64),让用户做出选择,或者同时发布两个版本,并使用检测CPU位数的启动器启动正确的版本。

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.

顺便说一句,您仍然需要 BrowserFlags 骇客,因为这样做会阻止您的工作从2007年开始成为Microsoft。Office2010仍然具有 ActiveX文档服务器支持,Office团队将在将来的某个时候删除该支持。因此,如果您依赖Office的ActiveX Document Server支持作为核心功能,则需要提前计划。

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.

这篇关于如何在64位操作系统中打开嵌入在Windowforms控件中的Excel(.xlsx)文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆