1

我正在使用 InstallShield 2012 为 Excel 加载项构建安装包。因为 MS Excel 有 32 位版本和 64 位版本,所以我需要单独构建安装包。理想情况下,在将文件复制到目标计算机之前,设置文件应该能够在安装的前几个步骤中检测 Excel 位数(而不是 Windows 位数)。然而,在网上进行了一些广泛的研究后,我还没有找到一种可靠的方法来确定 Excel 位数。任何有想法的人,请随时提供帮助。谢谢

4

3 回答 3

2

这是我使用的(LUA - 设置工厂)代码:即使未安装 Outlook,它也可以工作。

-- check if 64 bit office installed

s64_14 = Registry.GetValue(3, "Software\\Wow6432Node\\Microsoft\\Office\\14.0\\Outlook","Bitness",true);
s64_15 = Registry.GetValue(3, "Software\\Wow6432Node\\Microsoft\\Office\\15.0\\Outlook","Bitness",true);
s64_16 = Registry.GetValue(3, "Software\\Wow6432Node\\Microsoft\\Office\\16.0\\Outlook","Bitness",true);

bl64Bit = false;

if (s64_14=="x64" or s64_15=="x64" or s64_16=="x64") then
    bl64Bit = true
end

-- check for 64-bit OS
bl64BitOS=false;
if SessionVar.Expand("%ProgramFilesFolder%") ~= SessionVar.Expand("%ProgramFilesFolder64%") then
    bl64BitOS=true
end
于 2013-05-10T19:08:04.530 回答
0

我与Advanced Installer用户进行了类似的讨论,您可以在我们的论坛上查看它,该用户想要检测 Office 位数。

于 2013-05-11T14:49:20.177 回答
0

您应该创建 2 个属性来跟踪安装的 Excel 版本,然后将这些属性用作功能条件“EXCEL32_EXISTS=0”。这是我用来完成此操作的代码,最初 EXCEL32_EXISTS 和 EXCEL64_EXISTS 都设置为 0。

Excel_Installed=FALSE;
szKey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\excel.exe";

if (RegDBKeyExist(szKey)=1) then
        Excel_Installed=TRUE;
        RegDBGetKeyValueEx ( szKey, "Path", nvType, ExcelPath, nvSize );
        SprintfMsiLog( "Found Excel @ %s", ExcelPath );

        if ( StringContains(ExcelPath, "Office11")=TRUE ) then
            Excel_Installed=FALSE;
        elseif ( SYSINFO.bIsWow64=FALSE ) then
            MsiSetProperty(hMSI, "EXCEL32_EXISTS", "1");
        elseif ( (StringContains(ExcelPath, "(x86)")=TRUE) || (StringContains(ExcelPath, "Office12")=TRUE) ) then
            MsiSetProperty(hMSI, "EXCEL32_EXISTS", "1");
        else
            MsiSetProperty(hMSI, "EXCEL64_EXISTS", "1");
        endif;
endif;


export prototype BOOL StringContains(STRING,STRING);
function BOOL StringContains(szSource, szArgs)
    BOOL bContains;
begin

    if(szSource % szArgs) then
        bContains = TRUE;
    else
        bContains = FALSE;
    endif;

    return bContains;
end;
于 2013-05-13T21:12:05.383 回答