http://www.pptjcw.com

excel教程:Excel2007新知:轻车绕便道,题外不言他 #3 Excel在XLL方面所做

    Quick detour #3: Updates we have made to XLLs
    轻车绕便道,题外不言他 #3:Excel 12在XLL方面所做的更新

    In the past few months, I have written a couple of articles (big grid, multi-threaded calculation) that prompted comments and questions along the lines of “what about XLLs?” Since the email questions have actually been picking up in frequency (I guess a lot of readers are also XLL authors), I thought I would write a quick article that outlines the changes we are making in this area to support new functionality.
    在过去几个月里,围绕“XLL将会怎样”的主题我有写过两篇文章(《更大的表格》、《多线程计算》),给出了一些相关的注解及问题。由于我收到的邮件中关于这方面的提问至今仍有相当的频度(我估计这其中的许多读者也是XLL加载宏的作者),我想我还是得再写上一篇简短的文章,来给大家描绘一下我们在新函数的支持方面所作的变更。

    Stepping back for a minute, let me briefly explain XLLs. An XLL is a DLL that is written so that Excel can open it directly. XLLs can be used for a number of things, but (in my experience at least) the most common use of XLLs is creating user-defined worksheet functions (UDFs) to supplement Excel’s intrinsic functions. Developers who write XLLs do so for a number of reasons, the paramount being performance.
    先耽搁您几分钟时间,让我来简要地介绍一下XLL为何物。
    XLL文件实际上就是一个能够让Excel直接打开的DLL(动态链接库)文件。虽说XLL文件可以用来做很多事情,不过,至少在我的经验中是这样,其最通常的应用是创建用户自定义工作表函数,以扩充Excel的内置函数。(译者注:就这一点而言,用VBA也可以做,那为什么还要编译成XLL文件呢?)开发人员这样做的原因有很多,其中一个最重要的原因就是为了提高执行效率。

    We have made three changes to XLLs in Excel 12, primarily to give developers access to new functionality. With Excel 12, XLL authors will have support for
    ·The bigger grid
    ·More function arguments
    ·Multi-threaded calculation

    在Excel 12中,我们对XLL的相关应用作了三个方面的变更,主要目的是为了方便开发人员访问新的函数。透过Excel 12,XLL的开发者们将获得下列支持:
    ·更大的表格
    ·更多的函数参数
    ·多线程计算

    Big grid and more arguments
    更大的表格及更多的参数

    When building an XLL today, developers can use a special Excel data type called an “XLOPER”. An XLOPER is essentially a structure that allows developers to pass data types like references, arrays, and error values to and from Excel (technically, XLOPERs can contain 12 possible data types – if you are curious, here is some documentation on MSDN). Currently, several of the data types (i.e. the one that can be used to communicate a reference to and from Excel) are not big enough to support the dimensions of the bigger grid size in Excel 12.
    今天,当我们在构建XLL文件的时候,开发人员可以使用一种称之为“XLOPER”的专用数据类型(译者注:XLOPER是OPER 结构的增强版本。在Microsoft Excel 4.0及更高版本中,可以使用这种数据类型来编写调用Microsoft Excel函数的DLL和代码资源,使用XLOPER 结构,DLL函数除了可以传递数据外,还可以传递对工作表的引用并实现流控制)。这是一种基础数据结构,它允许开发人员在应用程序和Excel之间传递或返回诸如引用、数组及错误信息等数据(从技术上来讲,XLOPER能够包含12种可能的数据类型,如果你还想知道更多的话,请点击这里参阅MSDN上的相关资讯)。目前,这其中有一部分数据类型(比如其中一个用来与工作表引用区域交互通信的数据类型)尚不够大,不足以支持Excel 12增大的表格维度(译者注:关于Excel 12工作表的大小及其它方面限制的变更,请参阅Kevin翻译的《大片上映…》)。

    To address this, Excel 12 will implement a new XLOPER – which will be called something like XLOPER12 – which will have a larger reference (xltypeRef) data type and a larger array (xltypeMulti) data type which will support the entire big grid. In addition, XLOPER12 will support Unicode data and therefore strings larger than 255 characters. One happy by-product of the support for more characters is that XLLs written using XLOPER12 will be able to support 255 arguments, the same limit supported by Excel 12.
    有鉴于此,Excel 12将执行一套全新的XLOPER方案 – 我们暂且称之为XLOPER12。新方案将拥有一个更大的引用(xltypeRef)数据类型及一个更大的数组(xltypeMulti) 数据类型,以支持整个增大的工作表。另外,XLOPER12也将支持Unicode数据并因此能够支持长度超过255个字符的字符串数据,这项改进还带来另一个让人高兴的副产品,那就是使用XLOPER12开发的XLL能够支持多达255个参数,这与Excel 12能够支持的上限是一致的。

    The Excel12 function
    Excel12 函数

    提示:如果您觉得本文不错,请点击分享给您的好友!谢谢

    上一篇:excel怎么做表格:Excel的娱乐和游戏 下一篇:excel vba教程:Excel 2007条件格式中的新规则

    郑重声明:本文版权归原作者所有,转载文章仅为传播更多信息之目的,如作者信息标记有误,请第一时间联系我们修改或删除,多谢。