Excel2007新知:輕車繞便道,題外不言他 #3 Excel在XLL方面所做

      網友投稿 668 2025-03-31

      Excel2007新知:輕車繞便道,題外不言他 #3 Excel在XLL方面所做

      譯者:Rowen? 來源:http://blogs.msdn.com/excel 發表于:2006年7月7日

      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 更大的表格及更多的參數

      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能夠支持的上限是一致的。

      Excel2007新知:輕車繞便道,題外不言他 #3 Excel在XLL方面所做

      The Excel12 function Excel12 函數

      In order to use XLOPER12, developers will need to use a new C API function – Excel12 – instead of the existing Excel4 function. Excel12 is essentially the same function updated to handle the new XLOPER12, so if developers want to take advantage of any of the changes described above, they will need to update their code to call the new API. Note that existing code will continue to run as it always has, so developers will not face no backwards compatibility problems. 要使用XLOPER12的數據結構,開發人員必須使用一個新的C API函數-Excel12-來代替現有的Excel4。Excel12函數本質上講與Excel4是一樣的,升級的目的是為了操作XLOPER12,因此,開發人員如果想要獲得上述任何變更所帶來的優勢,就必須更新其代碼以調用新的API函數。當然,現有代碼能夠一如繼往地運行,開發人員不需要面對向后兼容的問題。

      Updating XLL’s to take advantage of multi-threaded calculation 更新XLL以利用多線程的計算

      As discussed in a previous post, Excel 12 will support multi-threaded calculation. Since performance is very important for the bulk of XLL authors, we wanted to give developers who write UDFs using XLLs a way to allow their XLLs to participate in multi-threaded calculation (meaning Excel would calc multiple UDFs at once thereby improving calculation times). 就像上一個帖子中討論的那樣,Excel12將會支持多線程計算。由于對大多數XLL開發者而言,產品性能是至關重要的,因此,我們應該給那些使用XLL編寫用戶自定義函數(UDFs)的開發人員們一個參與多線程計算的途徑,這就意味著Excel將能夠同時計算多個用戶自定義函數(UDFs),亦即提高了計算次數。

      To do so, XLL authors need to do two things. First, (the harder part) they need to make sure their XLL UDF (the code they wrote) is threadsafe (i.e. it must not make any non-thread-safe callbacks into Excel). Second, they need to make a minor update to their XLL to tell Excel 12 it is threadsafe. This is done in pretty much the same way that an XLL author would tell Excel that their function is volatile – by adding a special character to the “type text” entry in an XLL’s function table (the type text entry defines the data types for the functions’ return value and arguments). 要達成這一目標,XLL的開發人員需要做兩件事情:第一件事,也是最困難的一件,開發人員必須確保他們的代碼是線程安全的,也就是說,代碼不得造成任何導致Excel發生非線程安全的回調行為。第二件事,開發人員必須對他們的XLL代碼作一些小的更新,以便告訴Excel 12這些代碼是線程安全的。這一點,與XLL的開發人員通過為XLL函數表中的 “類型說明”入口點(用于定義函數返回值及參數的數據類型)添加某些特殊的字符,以此告訴Excel程序這些是易失性函數的作法,是非常相似的。

      Specifically, to indicate that an XLL function is safe for multi-threaded calculation, an XLL author needs to add a “$” to the type text entry in an XLL’s function table … so the type text entry for a UDF that had one argument would look like this “ RR$”. If this character is present, Excel will allow the UDF to participate in muti-threaded calc, just like Excel’s intrinsic functions; if the flag is absent, the reverse is true – all calls to that UDF will be run on a single thread. Note, the Excel4 API will also respond appropriately to the “$” character, so if an XLL author wants to take advantage of multi-threading, but doesn’t care about the big grid, they do not have to use the Excel12 API. 更確切地說,要明示一個XLL函數對于多線程計算是安全的話,XLL的開發人員必須為XLL函數表中的類型說明入口點添加一個“$”符號…如此,帶有一個參數的用戶自定義函數的類型說明入口點看起來就象這樣“ RR$”。如果這個字符有提交,Excel將允許用戶自定義函數參與多線程計算,就象是Excel的內置函數一樣;如果這個標志缺失的話,那么情況就相反-所有對用戶自定義函數的調用都將只能進行單線程計算。值得關注的是,Excel4 API函數同樣會對這個“$”符號作出適當的響應,因此,XLL的開發人員如果不想顧及Excel 12增大的表格,而又想利用多線程計算的話,他們不一定非得使用Excel12 API。

      Published Tuesday, January 03, 2006 2:48 PM by David Gainer

      附注:關于XLL加載宏的開發 1. 如何在C++語言環境中開發XLL加載宏,請參閱: http://support.microsoft.com/default.aspx?scid=kb;en-us;Q178474 2. 在Visual Studio 2005 中開發XLL加載宏,請參閱 http://blogs.msdn.com/eric_carter/archive/2004/12/01/273127.aspx

      版權聲明:本文內容由網絡用戶投稿,版權歸原作者所有,本站不擁有其著作權,亦不承擔相應法律責任。如果您發現本站中有涉嫌抄襲或描述失實的內容,請聯系我們jiasou666@gmail.com 處理,核實后本網站將在24小時內刪除侵權內容。

      版權聲明:本文內容由網絡用戶投稿,版權歸原作者所有,本站不擁有其著作權,亦不承擔相應法律責任。如果您發現本站中有涉嫌抄襲或描述失實的內容,請聯系我們jiasou666@gmail.com 處理,核實后本網站將在24小時內刪除侵權內容。

      上一篇:制造業安全生產管理臺賬(企業如何做好安全生產管理臺賬工作)
      下一篇:wps文檔太大怎么縮小(wps文檔太大怎么縮小2020)
      相關文章
      亚洲一卡二卡三卡| 亚洲精品9999久久久久无码| 在线观看亚洲AV每日更新无码| 久久久无码精品亚洲日韩蜜臀浪潮| 亚洲色成人WWW永久网站| 亚洲日韩人妻第一页| 亚洲成A人片在线观看无码3D | 亚洲AV噜噜一区二区三区| 亚洲中文字幕无码久久| 亚洲中文无码卡通动漫野外| 国产精品亚洲综合五月天| 亚洲精品一二三区| 亚洲人成网站999久久久综合| 亚洲AV日韩综合一区尤物 | 亚洲码和欧洲码一码二码三码| 亚洲日韩精品无码专区| 亚洲hairy多毛pics大全| 亚洲6080yy久久无码产自国产| av无码东京热亚洲男人的天堂| 亚洲国产成人五月综合网| 亚洲日韩国产精品乱| 国产精品亚洲片在线| 亚洲成a人片在线观看中文动漫| 亚洲av片劲爆在线观看| 亚洲欧洲日本精品| 亚洲天堂电影在线观看| 亚洲中文字幕无码一去台湾| 亚洲中文字幕乱码一区| 精品久久久久亚洲| 亚洲熟伦熟女新五十路熟妇 | 中文字幕一精品亚洲无线一区| 国产亚洲精品a在线观看app| 亚洲AV日韩AV天堂久久| 亚洲欧洲自拍拍偷午夜色| 精品亚洲456在线播放| 婷婷亚洲综合五月天小说在线| 亚洲另类激情专区小说图片| 中文字幕一精品亚洲无线一区| 亚洲A∨无码无在线观看| 亚洲国产精品无码久久久| 亚洲欧美日韩中文字幕一区二区三区|