如何使Win32 :: OLE工作在64位MS OFFICE安装 [英] How to make Win32::OLE work on 64bit MS OFFICE installation

查看:697
本文介绍了如何使Win32 :: OLE工作在64位MS OFFICE安装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两台电脑,一台已经安装了MS Office 2013 32bit,另一台安装了MS Office 64bit。
我有使用 Win32 :: OLE Perl模块来处理XLS电子表格。
该代码在32位计算机上工作得很好,但在64位计算机上出现问题。



在这里做了一些研究之后,我发现了。
问题是以下代码行:

 使用Win32 :: OLE :: Const'Microsoft Excel。*对象库; 

我看着 Win32 :: OLE :: Const 模块,似乎模块正在注册表中查找该库。当我从32位和64位打印出注册表中的所有条目时,我发现这个库在32位上可用,64位上不可用。



有没有办法要在64位上安装该库?如果没有,还有其他模块可以允许Excel的OLE自动化?



我所需要的所有Perl脚本都是打开XLS文件并将其另存为CSV。我正在使用 Spreadsheet :: ParseExcel Spreadsheet :: XLSX 在所有其他脚本。这个特定XLS文件的问题是它受密码保护,并使用非标准密码加密。所以 Spreadsheet :: ParseExcel 无法打开它。 Win32 :: OLE 在32位打开文件没有问题。



如果需要,可以提供代码。 p>

请指教。



谢谢,
-Andrey

解决方案

我使用您的 Win32 :: OLE :: Const 模块来使Perl中的Excel常量可用。 p>

最近,我有一个干净的Win7 x64安装与Office 2016,脚本不再工作(使用最新版本 Win32 :: OLE :: Const 模块,安装了当前(06/04/2016)ActiverPerl 64位安装)。



经过调查,我发现不过,$ code> Win32 :: OLE :: Const 没有看到Excel自动化对象,尽管它在注册数据库中已经很好地注册并可用。



在注册数据库中,以下键包含Excel可执行文件的路径:

  HKEY_LOCAL_MACHINE\SOFTWARE \Classes \TypeLib\ {00020813-0000-0000-C000-000000000046} \1.9\0\Win64 

如果我手动添加一个新密钥

  HKEY_LOCAL_MACHINE\SOFTWARE\Classes\TypeLib\ {00020813- 0000-0000-C000-000000000046} \1.9\0\Win32 

具有相同的路径对于Win64键,Perl脚本会找到Excel typelib并重新工作。



希望这有帮助。


I have two PCs, one has MS Office 2013 32bit installed and another MS Office 64bit installed. I have Perl code that is using Win32::OLE Perl module to manipulate XLS spreadsheets. The code is working perfectly fine on 32bit PC, but has a problem on 64bit one.

After doing some research here is what I found out. The problem is the following line of code:

use Win32::OLE::Const 'Microsoft Excel .* Object Library';

I looked inside Win32::OLE::Const module and it seems that the module is looking for that library in the registry. When I printed out all entries from the registry from both 32 and 64 bit I found out that this library is available on 32bit and not available on 64bit.

Is there a way to install that library on 64 bit? If not, are there any other modules that would allow OLE automation of Excel?

All my Perl script needs to do is to open XLS file and save it as CSV. I am doing it with Spreadsheet::ParseExcel and Spreadsheet::XLSX in all other scripts. The problem with this particular XLS file is that it is password protected and using non-standard password encryption. So Spreadsheet::ParseExcel is not able to open it. Win32::OLE has no issues opening the file on 32bit.

Code can be provided if needed.

Please advise.

Thank you, -Andrey

解决方案

I use your Win32::OLE::Const module to have the Excel constants available in Perl.

Recently, I had a clean Win7 x64 install with Office 2016 and the script was not working anymore (using the latest version Win32::OLE::Const module which is installed with the current (on 06/04/2016) ActiverPerl 64 bit installation).

After some investigation, I have found out that the Win32::OLE::Const did not see the Excel automation object although it was well registered and available in the registration database.

In the registration database the following key contains the path to the Excel executable:

HKEY_LOCAL_MACHINE\SOFTWARE\Classes\TypeLib\{00020813-0000-0000-C000-000000000046}\1.9\0\Win64

If I add manually a new key

HKEY_LOCAL_MACHINE\SOFTWARE\Classes\TypeLib\{00020813-0000-0000-C000-000000000046}\1.9\0\Win32 

with the same path as for the Win64 key then the Perl script found the Excel typelib and worked again.

Hope this helps.

这篇关于如何使Win32 :: OLE工作在64位MS OFFICE安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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