【问题标题】:Missing MSDN documentation to develop xll add ins?缺少 MSDN 文档来开发 xll 插件?
【发布时间】:2013-06-18 17:27:57
【问题描述】:

我花了很多时间寻找所有 C API XLM 函数的完整文档,但没有成功。

我发现这个页面说明了其中的一些: http://msdn.microsoft.com/en-us/library/office/bb687910%28v=office.12%29.aspx

但例如我想了解和使用 xlfAddMenu,但我在 MSDN 上找不到解释我的页面。

您知道是否有任何可用的文档吗?显然,要到达那里并不容易。

【问题讨论】:

    标签: c excel msdn xll xlm


    【解决方案1】:

    没有针对所有 C API XLM 函数的详尽官方文档。然而,正如documentation 所说的关于 C API XLM 函数的以下内容:

    Excel 通过 C API 公开了更多有用的函数 当您开发 XLL 时。它们对应于 Excel 工作表 XLM 宏中可用的函数和函数和命令 床单。”

    另外,SDK 安装附带的EXAMPLE.[C,H] 文件使用了其中的一些功能,您可以通过它来学习如何使用它们。比如xlfAddMenuxlAutoOpen回调函数中使用。

    // In the following block of code, the Generic drop-down menu is created.
    // Before creation, a check is made to determine if Generic already
    // exists. If not, it is added. If the menu needs to be added, memory is
    // allocated to hold the array of menu items. The g_rgMenu[] table is then
    // transferred into the newly created array. The array is passed as an
    // argument to xlfAddMenu to actually add the drop-down menu before the
    // help menu. As a last step the memory allocated for the array is
    // released.
    //
    // This block uses TempStr12() and TempNum12(). Both create a temporary
    // XLOPER12. The XLOPER12 created by TempStr12() contains the string passed to
    // it. The XLOPER12 created by TempNum12() contains the number passed to it.
    // The Excel12f() function frees the allocated temporary memory. Both
    // functions are part of the framework library.
    
    Excel12f(xlfGetBar, &xTest, 3, TempInt12(10), TempStr12(L"Generic"), TempInt12(0));
    
    if (xTest.xltype == xltypeErr)
    {
        hMenu = GlobalAlloc(GMEM_MOVEABLE,sizeof(XLOPER12) * g_rgMenuCols * g_rgMenuRows);
        px = pxMenu = (LPXLOPER12) GlobalLock(hMenu);
    
        for (i=0; i < g_rgMenuRows; i++)
        {
            for (j=0; j < g_rgMenuCols; j++)
            {
                px->xltype = xltypeStr;
                px->val.str = TempStr12(g_rgMenu[i][j])->val.str;
                px++;
            }
        }
    
        xMenu.xltype = xltypeMulti;
        xMenu.val.array.lparray = pxMenu;
        xMenu.val.array.rows = g_rgMenuRows;
        xMenu.val.array.columns = g_rgMenuCols;
    
        Excel12f(xlfAddMenu,0,3,TempNum12(10),(LPXLOPER12)&xMenu,TempStr12(L"Help"));
    
        GlobalUnlock(hMenu);
        GlobalFree(hMenu);
    }
    

    【讨论】:

      【解决方案2】:

      据我所知,最好的文档(但未更新..)是以下书籍:Steve Dalton 编写的 C/C++ 中使用 Excel 插件开发的金融应用程序,第二版。您可以在第 332 页找到有关 xlfAddMenu 功能的说明。您还可以在 Microsoft Excel XLL 软件开发工具包的 chm 文件中找到一些有用的信息,包括代码示例(注意我没有在其中找到 xlfAddMenu,所以我猜它是折旧功能)。

      【讨论】:

        猜你喜欢
        • 2014-06-03
        • 1970-01-01
        • 1970-01-01
        • 2015-12-04
        • 1970-01-01
        • 1970-01-01
        • 2022-01-23
        • 2015-04-01
        • 1970-01-01
        相关资源
        最近更新 更多