[英]Does Win32::OLE::Const->Load('Microsoft Excel'); depends on Excel version
I'm using Win32::OLE::Const->Load()
in perl :我在 perl 中使用Win32::OLE::Const->Load()
:
$xl = Win32::OLE::Const->Load('Microsoft Excel');
then I test if scalar(keys %{$xl})
is zero :然后我测试scalar(keys %{$xl})
是否为零:
if (scalar(keys %{$xl})==0) {
return False;
}
else {
return True;
}
I tested this code in machine which supports Microsoft Excel 2003 it gives True
, but when I tested the same code in machine where there is Microsoft Excel 2013 it gives me False
!我在支持 Microsoft Excel 2003 的机器上测试了这段代码,它给出了True
,但是当我在装有 Microsoft Excel 2013 的机器上测试相同的代码时,它给了我False
!
I also printed the scalar(keys %{$xl}
in the first machine it gives 2023, in the second machine it is 0!我还在第一台机器上打印了scalar(keys %{$xl}
,它给出了 2023,在第二台机器上它是 0!
Best Regards此致
after searching I found the solution.搜索后我找到了解决方案。
it gives 0 in the second machine cuz there is no win32 Excel key in the registre.它在第二台机器中给出 0,因为注册表中没有 win32 Excel 键。
the solution is adding win32 key in HKEY_CLASSES_ROOT\\TypeLib\\{00020813-0000-0000-C000-000000000046}\\1.8\\0\\
解决方案是在HKEY_CLASSES_ROOT\\TypeLib\\{00020813-0000-0000-C000-000000000046}\\1.8\\0\\
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.