Introduction 介绍
- The core library project can be found on GitHub, where the latest source versions are hosted.
核心库项目可以在 GitHub 上找到,最新的源代码版本也托管在那里。 - For general questions and discussion about Excel-DNA, use the Google group or Stack Overflow.
对于关于 Excel-DNA 的一般问题和讨论,请使用 Google 组或 Stack Overflow。 - Specific issues, bug reports and feature requests can be added to the GitHub Issues list.
特定问题、错误报告和功能请求可以添加到 GitHub 问题列表中。 - For more about Excel-DNA, see the introductory information below, and the searchable (back to February 2007) Google group history.
有关 Excel-DNA 的更多信息,请参阅下面的入门信息,以及可追溯至 2007 年 2 月的 Google 组历史记录。 - For a permanent bookmark to the project, use the Excel-DNA home page at http://excel-dna.net.
为了获得该项目的永久书签,请使用 Excel-DNA 主页 http://excel-dna.net。
Overview 概览
Excel-DNA is an independent project to integrate .NET into Excel. We hope it will be useful to Excel users who currently write VBA code for functions and macros, and would like to start using .NET. Also interested would be C/C++ based .xll add-in developers who want to use the .NET framework to develop their add-ins.
Excel-DNA 是一个将.NET 集成到 Excel 中的独立项目。我们希望它对目前使用 VBA 编写函数和宏的 Excel 用户以及希望开始使用.NET 的用户有用。此外,对使用.NET 框架开发其附加组件的 C/C++基于.xll 的附加组件开发人员也可能感兴趣。
(For a bit more background about .NET and Excel-DNA, see What and why? - An introduction to .NET and Excel-DNA.
(为了更多关于.NET 和 Excel-DNA 的背景信息,请参见 What and why? - .NET 和 Excel-DNA 的介绍。)
The Excel-DNA Runtime is free for all use, and distributed under a permissive open-source license that also allows commercial use.
Excel-DNA 运行时免费用于所有用途,并以允许商业使用的宽松开源许可证分发。
Excel-DNA is developed using .NET, and users have to install the freely available .NET Framework runtime. The integration is by an Excel Add-In (.xll) that exposes .NET code to Excel. The user code can be in text-based (.dna) script files (C#, Visual Basic or F#), or compiled .NET libraries (.dll). Excel-DNA supports both the .NET runtime version 2.0 (which is used by .NET versions 2.0, 3.0 and 3.5) and version 4. Add-ins can target either version of the runtime, and concurrent loading of both runtime versions into an Excel instance is supported.
Excel-DNA 使用.NET 开发,用户需要安装免费提供的.NET 框架运行时。通过 Excel 插件(.xll)进行集成,该插件将.NET 代码暴露给 Excel。用户代码可以是基于文本的(.dna)脚本文件(C#、Visual Basic 或 F#),或编译的.NET 库(.dll)。Excel-DNA 支持.NET 运行时版本 2.0(用于.NET 版本 2.0、3.0 和 3.5)和版本 4。插件可以针对这两种运行时版本中的任意一种进行开发,并且 Excel 实例中同时加载这两种运行时版本是支持的。
Excel versions '97 through 2016 can be targeted with a single add-in. Advanced Excel features are supported, including multi-threaded recalculation (Excel 2007 and later), registration-free RTD servers (Excel 2002 and later) and customized Ribbon interfaces (Excel 2007 and 2010). There is support for integrated Custom Task Panes (Excel 2007 and later), offloading UDF computations to a Windows HPC cluster (Excel 2010 and later), and for the 64-bit versions of Excel 2010 and 2013.
Excel 97 至 2016 版本可以通过一个插件进行目标定位。支持高级 Excel 功能,包括多线程重算(Excel 2007 及以后版本),注册免费 RTD 服务器(Excel 2002 及以后版本)和自定义 Ribbon 界面(Excel 2007 和 2010)。支持集成自定义任务窗格(Excel 2007 及以后版本),将 UDF 计算卸载到 Windows HPC 群集(Excel 2010 及以后版本),以及 Excel 2010 和 2013 的 64 位版本。
Most managed UDF assemblies developed for Excel Services can be exposed to the Excel client with no modification. (Please contact us if you are interested in this feature)
大多数为 Excel Services 开发的托管 UDF 程序集可以直接暴露给 Excel 客户端,无需修改。(如有兴趣,请联系我们)
The latest release - Excel-DNA Latest - includes support for both RTD-based asynchronous worksheet functions (Excel 2002 and later) and native Excel asynchronous functions (Excel 2010 and later). The RTD-based asynchronous support is designed to (optionally) integrate with the .NET 4.0 Task-based operations, as well as the Reactive Extensions library, allowing IObservables to be exposed as 'live' worksheet UDFs - (thus 'RxExcel'). The language-specific support for asynchronous functions in C# 5, Visual Basic 11 and F# 2.0 can be easily integrated with the Excel-DNA asynchronous interfaces.
最新的发布 - Excel-DNA Latest - 包括对基于 RTD 的异步工作表函数(Excel 2002 及以后版本)和原生 Excel 异步函数(Excel 2010 及以后版本)的支持。基于 RTD 的异步支持旨在(可选地)与.NET 4.0 的任务操作以及 Reactive Extensions 库集成,允许将 IObservables 暴露为“实时”的工作表 UDF - (因此是“RxExcel”)。C# 5、Visual Basic 11 和 F# 2.0 中的异步函数语言特定支持可以轻松与 Excel-DNA 异步接口集成。
Are there no other ways to create Excel add-ins with .NET? Why should I use Excel-DNA?
使用.NET 创建 Excel 插件还有其他方法吗?为什么我应该使用 Excel-DNA?
There are a few different ways of making Excel add-ins with .NET, but Excel-DNA has unique advantages. For starters, these are the different kinds of Excel add-ins that can be created with .NET:
使用.NET 创建 Excel 插件有几种不同的方法,但 Excel-DNA 具有独特的优势。首先,这些是使用.NET 可以创建的不同类型的 Excel 插件:
- VSTO
- COM add-in COM 插件
- C API
- Other libraries (e.g. NetOffice, Add-In Express, FCell)
其他库(例如 NetOffice、Add-In Express、FCell)
Where does Excel-DNA fit in?
Excel-DNA 处于什么位置?
Excel-DNA brings together all three parts that are needed to make a great Excel add-in with .NET - the native Excel C API, the COM object model and the .NET runtime.
Excel-DNA 将所有三部分结合在一起,使 Excel .NET 模块成为优秀的 Excel 插件 - 原生 Excel C API、COM 对象模型和 .NET 运行时。
Should I not just stick to the official Microsoft tools for making Excel add-ins, rather than relying on a third-party tool?
我应该仅仅依赖微软官方的工具来制作 Excel 插件,而不是依赖第三方工具吗?
Using only Microsoft's tools makes it hard to create powerful and full-featured Excel add-ins with .NET that work in different Excel versions, and that are easy to deploy. Some of the problems are:
仅使用微软的工具很难创建具有强大功能和完整功能的 Excel .NET 插件,这些插件可以在不同的 Excel 版本中工作,并且易于部署。其中一些问题是:
- Microsoft has no official support for using the native Excel C API in .NET add-ins
微软没有官方支持在 .NET 插件中使用原生 Excel C API - VSTO has no support for making user-defined worksheet functions
VSTO 没有支持用户定义的工作表函数 - Automation add-ins can provide UDF, but have poor performance, and allow limited customization
自动化加载项可以提供 UDF,但性能较差,并且允许的自定义有限 - VSTO and regular COM-based add-ins require administrative rights to install
VSTO 和基于常规 COM 的加载项需要管理员权限才能安装
What if I want to make an Excel add-in with Python, C or C++?
如果我想用 Python、C 或 C++制作一个 Excel 加载项呢?
Excel-DNA is used for making Excel add-ins with .NET. For alternative programming languages, there are similar libraries that integrate with the native Excel C API, such as:
Excel-DNA 用于制作基于 .NET 的 Excel 插件。对于其他编程语言,有类似库可以与原生 Excel C API 集成,例如:
- Python: PyXLL
- C/C++: Xlw, XLL+
- Modern C++: xll8. 现代 C++: xll8.
What about VBA? Can Excel-DNA help me use my current VBA skills and still move to .NET?
VBA 呢?Excel-DNA 能否帮助我利用现有的 VBA 技能,同时转向.NET?
VB.NET is the newest member of the Visual Basic family. While sometimes overshadowed in popularity by C#, VB.NET is as powerful as C# (sometimes more!), can access all the same .NET libraries, and is fully supported for making Excel-DNA add-ins. Using VB.NET gives a degree of familiar syntax for those who are coming from VBA, requiring a gradual learning curve to get used to the few existing differences. However, rest assured that VB.NET provides access to the full power of .NET and Excel-DNA.
VB.NET 是 Visual Basic 家族的最新成员。尽管有时在受欢迎程度上被 C#所超越,但 VB.NET 与 C#一样强大(有时更强大),可以访问所有相同的.NET 库,并且完全支持制作 Excel-DNA 插件。使用 VB.NET 可以为那些来自 VBA 的人来说提供熟悉的语法,需要逐渐学习一些现有的差异。然而,请放心,VB.NET 提供了.NET 和 Excel-DNA 的全部功能。
Excel-DNA add-ins can also integrate with VBA code by creating custom COM libraries that can be called from VBA. One advantage in putting these libraries inside an Excel-DNA add-in is that they can be deployed without requiring registration with administrator privileges.
Excel-DNA 插件还可以通过创建可以在 VBA 中调用的自定义 COM 库来与 VBA 代码集成。将这些库放在 Excel-DNA 插件中的一个优点是,它们可以部署而无需管理员权限进行注册。
Important Links 重要链接
The home page for Excel-DNA is at http://www.excel-dna.net.
Excel-DNA 的主页是 http://www.excel-dna.net。
The documentation is still sparse, but if you need any help, try the main Excel-DNA support forum on Google Groups, https://groups.google.com/group/exceldna, where an extensive history of discussions can be found and searched through.
文档仍然比较稀疏,但如果您需要任何帮助,请尝试 Google Groups 上的主要 Excel-DNA 支持论坛 https://groups.google.com/group/exceldna,那里有丰富的讨论历史可以查看和搜索。
You are also welcome to contact us with questions, comments or suggestions.
您也可以联系我们提出问题、评论或建议。
How To's 如何操作
- Excel-DNA Packing Tool The packing utility allow you to pack your add-in into a single
.xll
file for easy distribution.
Excel-DNA 打包工具 打包工具允许您将插件打包成一个.xll
文件,以便于分发。 - Installing your add-in and running generally.
安装您的插件并运行。 - Accepting Range Parameters in UDFs.
接受范围参数的 UDF。 - Integrating with VBA 与 VBA 集成
- Performing Asynchronous Work
执行异步工作 - Optional Parameters and Default Values
选填参数和默认值 - Keyboard Shortcut 键盘快捷键
- Excel Programming Interfaces
Excel 编程接口 - Ribbon Customization and various ribbon links.
菜单自定义和各种菜单链接。 - A note on AutoClose and Detecting Excel Shutdown.
关于 AutoClose 和检测 Excel 关闭的说明。 - Debugging Notes 调试说明
- COM Server Support COM 服务器支持
- Some notes on FSharp Type Inference, and FSharp Standalone Assemblies.
有关 FSharp 类型推断的一些说明,以及 FSharp 独立程序集。 - Asynchronous Functions 异步函数
- Asynchronous Functions with Tasks example in VB.NET.
VB.NET 中的异步函数示例(使用 Tasks)。 - Reactive Extensions for Excel
Excel 的 Reactive Extensions - Dynamic delegate registration - an advances feature to implement runtime registration and function wrappers.
动态代理注册 - 一种高级功能,用于实现运行时注册和函数包装。 - User settings and the .xll.config file
用户设置和.xll.config 文件 - A step-by-step guide to build a new add-in using the NuGet package, and then Configure NLog logging for your add-in.
使用 NuGet 包构建新的插件的逐步指南,然后为您的插件配置 NLog 日志记录。 - Creating a help file
创建帮助文件 - Returning 1-D Arrays 返回 1 维数组
- Async macro example - formatting the calling cell from a UDF
异步宏示例 - 从 UDF 格式化调用单元格 - Enumerating Excel COM Automation collections in VB.NET
枚举 Excel COM 自动化集合在 VB.NET 中 - Modal dialog on new thread
新线程上的模态对话框 - Utilizing custom XML parts in Excel Workbooks
在 Excel 工作簿中使用自定义 XML 部分 - Checking for updates and download of Excel-DNA Addins (or other .NET based programs)
检查更新并下载 Excel-DNA 插件(或其他基于.NET 的程序)
Samples 样品
Various sample projects and snippets related to Excel-DNA are available in the Samples repository.
Excel-DNA Samples 仓库中包含各种与 Excel-DNA 相关的示例项目和代码片段。
Excel-DNA Extension Projects
Excel-DNA 扩展项目
- ExcelDnaDoc provides tools to make help generation easier.
ExcelDnaDoc 提供工具以简化帮助文件的生成。 - Registration allows the automatic generation of parameter and function conversions, removing boiler-plate code for optional parameters, async functions etc.
注册可以自动生成参数和函数转换,移除可选参数、异步函数等的样板代码。 - IntelliSense add in-sheet IntelliSense for Excel UDFs.
IntelliSense 插件为 Excel UDFs 在工作表内提供 IntelliSense。
Community Projects 社区项目
- ExcelDna-Unpack is a command-line utility to extract the contents of Excel-DNA add-ins packed with ExcelDnaPack
ExcelDna-Unpack 是一个命令行工具,用于提取使用 ExcelDnaPack 包装的 Excel-DNA 插件的内容 - ExcelDna.Abstractions facilitates mocking & unit testing of Excel-DNA Add-Ins
ExcelDna.Abstractions 便于模拟和单元测试 Excel-DNA 扩展插件 - ExcelDna.WiXInstaller is a user-contributed template (thank you very much to Lee Zeitz!) for making a WiX-based installer for an Excel-DNA add-in.
ExcelDna.WiXInstaller 是一个用户贡献的模板(非常感谢 Lee Zeitz!)用于制作基于 WiX 的 Excel-DNA 插件安装程序。 - ExcelDna.StrongName provides strong name key pair used to sign Excel-DNA assemblies.
ExcelDna.StrongName 提供用于签署 Excel-DNA 组件的强名称密钥对。 - ExcelDna.Diagnostics.Serilog integrates Excel-DNA Diagnostic Logging with your Serilog logging pipeling within your Excel-DNA Add-In
ExcelDna.Diagnostics.Serilog 将 Excel-DNA Diagnostic Logging 与您的 Serilog 日志管道集成到您的 Excel-DNA Add-In 中。 - Serilog.Sinks.ExcelDnaLogDisplay is a Serilog sink that writes events to Excel-DNA LogDisplay
Serilog.Sinks.ExcelDnaLogDisplay 是一个 Serilog 汇入器,将事件写入 Excel-DNA LogDisplay。 - Serilog.Enrichers.ExcelDna is a Serilog Enricher with properties from Excel-DNA Add-Ins
Serilog.Enrichers.ExcelDna 是一个带有 Excel-DNA Add-Ins 属性的 Serilog 汇入器。
External Links 外部链接
If you are a VBA developer interested in moving to .NET, you should start with Patrick O'Beirne's detailed VBA to Excel-DNA migration guide.
如果你是一名对迁移到.NET 感兴趣的 VBA 开发人员,你应该从帕特里克·奥贝林的详细的 VBA 到 Excel-DNA 迁移指南开始。
Various Samples and Tutorials
各种示例和教程
- Hugo Diz - TextUtilsDNA is a useful text processing add-in, and also a nice example add-in created with VB.NET.
胡戈·迪兹 - TextUtilsDNA 是一个有用的文本处理插件,也是一个用 VB.NET 创建的不错的示例插件。 - As a comprehensive example using many of the Excel-DNA features, be inspired by the Financial Analytics Suite (FinAnSu), an open-source C# add-in built by Bryan McKelvey.
作为一个全面的示例,使用了许多 Excel-DNA 功能,请以 Bryan McKelvey 创建的开源 C# 插件 Financial Analytics Suite (FinAnSu) 为灵感。 - Ross McLean has a series of posts on getting started with Excel-DNA.
Ross McLean 有一系列帖子介绍了如何开始使用 Excel-DNA。 - Mikael Katajamäki shows how to use Microsoft Solver Foundation to build a curve fitting function for Excel
米凯尔·卡塔贾马基展示了如何使用 Microsoft Solver Foundation 为 Excel 构建曲线拟合函数 - Mikael Katajamäki shows how to use C++/CLI code as a wrapper class for native (Quantlib based) C++ code and interfaced the C# client code to Excel by using Excel-DNA
米凯尔·卡塔贾马基展示了如何使用 C++/CLI 代码作为原生(基于 Quantlib 的)C++代码的封装类,并通过使用 Excel-DNA 将 C#客户端代码与 Excel 进行接口连接 - Simon Murphy - xlls with Excel-DNA
西蒙·墨菲 - xlls 与 Excel-DNA - Ed Parcell - Numerical analysis in Excel using C# with Excel-DNA and AlgLib
Ed Parcell - 使用 Excel-DNA 和 AlgLib 在 Excel 中进行 C# 数值分析 - Mathias Brandewinder - Mutant Excel with .NET and Excel-DNA
Mathias Brandewinder - 使用 .NET 和 Excel-DNA 变异 Excel - Mathias Brandewinder - Supercharge Excel functions with Excel-DNA and .NET parallelism
Mathias Brandewinder - 使用 Excel-DNA 和 .NET 并行性增强 Excel 函数 - Mike Woodhouse - A third way: DNA?
Mike Woodhouse - 第三种方式:DNA? - Patrick O'Beirne - From VBA to VB.NET using Excel-DNA
Patrick O'Beirne - 使用 Excel-DNA 从 VBA 迁移到 VB.NET - Doctor Torsten - Bring Excel 2010 to Speed: Remote UDFs with Excel 2010 and HPC Server 2008 R2
Doctor Torsten - 用 Excel 2010 和 HPC Server 2008 R2 提高速度:远程 UDFs - Luca Bolognese - A trading/portfolio management Excel Add-in based on the books by Ralph Vince
Luca Bolognese - 一本基于 Ralph Vince 的书籍的交易/投资组合管理 Excel 插件 - Supermab's series of blog posts introducing Excel-DNA to Japan (in Japanese)
超马系列关于介绍 Excel-DNA 给日本的文章(日文) - Joao Morais - WCF client sample
乔阿奥·莫赖斯 - WCF 客户端示例 - teramonagi - Using R from Excel using Excel-DNA (Also check out the F# R type provider.)
teramonagi - 使用 Excel-DNA 从 Excel 中使用 R 语言(请参阅 F# R 类型提供程序。) - Gert-Jan van der Kamp - Streaming real-time data to Excel
Gert-Jan van der Kamp - 将实时数据流式传输到 Excel - Eddie Gahan - TransposeBy - Extending Excel With C# And Excel-DNA
Eddie Gahan - TransposeBy - 用 C# 和 Excel-DNA 扩展 Excel
Various F# Examples 各种 F# 示例
- a wrapper for the ExcelReference type and C API with some cell access features,
ExcelReference 类型和 C API 的封装,具有某些单元格访问功能, - an object handle wrapper, and
对象句柄封装, - a WPF-based Custom Task Pane for Excel.
一个基于 WPF 的 Excel 自定义任务窗格。 - Three samples, including a function using the R type provider by Natallie Baikevich.
三个示例,包括一个使用 Natallie Baikevich 提供的 R 类型提供程序的函数。 - Bram Jochems has published a wonderful collection of finance-related functions on GitHub, as well as some details on creating a ribbon menu with F#.
Bram Jochems 在 GitHub 上发布了一套优秀的金融相关函数集合,同时还详细介绍了如何使用 F# 创建 ribbon 菜单。 - Useful Range wrappers by Kit Eason: Higher-Order Functions for Excel.
有用的 Range 包装器由 Kit Eason 提供:Excel 的高阶函数。
External projects using Excel-DNA
使用 Excel-DNA 的外部项目
Dodoni.net is a free/open-source library for quantitative finance and numerical computing..
Dodoni.net 是一个免费/开源的库,用于量化金融和数值计算。Cubicle Tools is a collection of tools that extends Excel for analytical and rapid development purposes. It includes an object handler and an add-in distribution system.
Cubicle Tools 是一组扩展 Excel 用于分析和快速开发的工具。它包括一个对象处理程序和一个插件分发系统。Technoscience UK has some interesting add-ins to mirror Excel data between PCs.
Technoscience UK 有一些有趣的插件可以镜像 PC 之间的 Excel 数据。Niels Bosma - SEOTools add-in (free, but not open source)
尼尔斯·博斯马 - SEOTools 插件(免费,但不是开源的)compute!box! allows real-time interchange of data between spreadsheets (via Azure Service Bus).
compute!box!允许在实时交换数据之间在电子表格之间进行交互(通过 Azure 服务总线)。This Office icon gallery has an Excel-based viewer.
这个 Office 图标库有一个基于 Excel 的查看器。Jon Nyman's FxToExcel add-in brings financial program data into Excel.
Jon Nyman 的 FxToExcel 插件将金融程序数据带入 Excel。Stock Quote Add-In for Excel provides access to the Yahoo financial data through an Excel-DNA add-in.
Excel 股票报价插件通过 Excel-DNA 插件提供了对雅虎财经数据的访问。DB-Addin for Excel is an MS Excel Addin for retrieving Database data via userdefined functions into Excel and writing Data (DBMapper), executing generic DML (DBAction) and doing all this in Sequences (DBSequence).
DB-Addin for Excel 是一个 MS Excel 插件,用于通过用户定义函数将数据库数据检索到 Excel 中,并写入数据(DBMapper),执行通用 DML(DBAction),并在序列中完成所有这些操作(DBSequence)。Datepicker is a replacement for the MSCOMCT2 based Datepicker that Microsoft abandoned in 64bit versions of Excel. It passes the .NET MonthCalendar widget to VBA Userforms.
日期选择器是微软在 64 位版本的 Excel 中放弃的 MSCOMCT2 基于的日期选择器的替代品。它将.NET MonthCalendar 小部件传递给 VBA 用户窗体。Alex Chirokov's ACQ add-in provides a library of interpolation routines for Excel. The add-in includes 1D and 2D interpolators, scatter plot smoothing and a Mersenne Twister random number generator. To have a closer look:
Alex Chirokov 的 ACQ 插件为 Excel 提供了插值函数库。该插件包括 1D 和 2D 插值器、散点图平滑和梅森 Twister 随机数生成器。要详细了解:- Find the current release on GitHub: https://github.com/ratesquant/ACQ/releases
在 GitHub 上找到当前版本: - With the main repository on GitHub at https://github.com/ratesquant/ACQ
在 GitHub 上的主要仓库位于 https://github.com/ratesquant/ACQ - A very clear introduction to the library, including some of it's advanced features, is posted on Code Project: http://www.codeproject.com/Articles/1097174/Interpolation-in-Excel-using-Excel-DNA
Features I like about the add-in (apart from it using Excel-DNA) include:
这是一个非常清晰的库介绍,包括一些高级功能,可以在 Code Project 上找到:[Excel-DNA 使用实现 Excel 中的插值功能](http://www.codeproject.com/Articles/1097174/Interpolation-in-Excel-using-Excel-DNA)。我喜欢这个插件的一些功能(除了使用 Excel-DNA 之外)包括: - A liberal open-source license
一个自由的开源许可证 - A clear and authoritative implementation of a particular domain
一个特定领域的清晰而权威的实现 - Very nice example of using object handles - an interpolator is build from the data, and then used to interpolate many values. ACQ has a clean implementation and great example of this technique.
非常不错的对象句柄使用示例 - 从数据构建一个插值器,然后用于插值许多值。ACQ 有一个简洁的实现,并且是一个这种技术很好的示例。 - All the functions have a common prefix ("
=acq
..."), making them easy to find in the function list, and use with the Excel-DNA IntelliSense extension.
所有函数都有一个共同的前缀("=acq
" ...),这使得它们在函数列表中容易找到,并且可以与 Excel-DNA IntelliSense 扩展一起使用。 - PS: ACQ has a bonus feature that implements a Sudoku solver (and generator)! See the write-up here: Sudoku Solver in Excel using C# and Excel-DNA.
PS: ACQ 有一个额外功能,实现了一个数独求解器(和生成器)!有关详细内容,请参阅此处:使用 C# 和 Excel-DNA 在 Excel 中实现的数独求解器。
- Find the current release on GitHub: https://github.com/ratesquant/ACQ/releases
I noticed a very nice add-in developed by Bryan McKelvey called FinAnSu. The whole add-in is generously available under the MIT open source license, and is a fantastic example of what can be built with Excel-DNA.
我注意到 Bryan McKelvey 开发的一个非常不错的插件叫 FinAnSu。整个插件在 MIT 开源许可证下慷慨地提供,是用 Excel-DNA 构建的绝佳范例。FinAnSu uses a ribbon interface to make the various functions and macros easy to find. The RTD server support is used to implement asynchronous data update functions, providing a live quote feed from Bloomberg, Google or Yahoo! And then there is a bunch of useful-looking financial functions. Here's a little preview:
FinAnSu 使用了功能区界面,使得各种函数和宏很容易找到。它使用 RTD 服务器支持来实现异步数据更新功能,提供来自 Bloomberg、Google 或 Yahoo 的实时报价。然后还有一些看起来很有用的金融函数。这里有一个小小的预览:
- Find the project on GitHub: https://github.com/brymck/finansu, with detailed documentation.
在 GitHub 上找到该项目:https://github.com/brymck/finansu,附有详细文档。 - You can browse through the source code online, and you can also download a copy of the whole project.
您可以在网上浏览源代码,并可以下载整个项目的副本。
Support 支持
There is a searchable record of more than 5000 messages on the Excel-DNA Google Group.
Excel-DNA Google 组中包含超过 5000 条可搜索的消息记录。
There are many questions answered on Stack Overflow under the tag excel-dna
.
在带有标签 excel-dna
的 Stack Overflow 问题中回答了许多问题。
Please don't hesitate to ask. If you are stuck or need some help using Excel-DNA your questions really are very welcome - whether you are just getting started, or an Excel-DNA expert.
请不要犹豫提问。如果你在使用 Excel-DNA 时遇到困难或需要帮助,你的问题非常欢迎——无论你是刚刚开始使用,还是 Excel-DNA 专家。
And if you could help put together some proper documentation, please contact me. We'd be happy to add you as an editor in this repository.
如果您能帮忙整理一些正式的文档,请联系我。我们很乐意将您添加为本仓库的编辑。
Related Projects 相关项目
- NetOffice is a set of version-independent assemblies to allow Office integration through the COM automation interface. The NetOffice libraries can be used from an Excel-DNA add-in to ease version-independent Excel add-in development, and ease compatibility with VBA.
NetOffice 是一组版本独立的程序集,可通过 COM 自动化接口实现 Office 集成。NetOffice 库可以从 Excel-DNA 插件中使用,以简化版本独立的 Excel 插件开发,并简化与 VBA 的兼容性。 - Visual Studio Tools for Office (VSTO) is Microsoft's preferred plan for integrating .NET with Office. It is mainly aimed at making it easy for Visual Studio developers to create solutions integrated with the Office applications. In contrast, Excel-DNA is (eventually) aimed at Excel end-users, as a compelling replacement for VBA, completely independent of Visual Studio.
Visual Studio Tools for Office (VSTO) 是 Microsoft 用于将 .NET 与 Office 集成的首选方案。它主要针对的是让 Visual Studio 开发者能够轻松创建与 Office 应用程序集成的解决方案。相比之下,Excel-DNA 最终是针对 Excel 终端用户,作为一个有吸引力的 VBA 替代品,完全独立于 Visual Studio。 - Add-in Express is a commercial alternative to VSTO for users with Visual Studio. It support making add-ins for the various Office products, not just Excel, and has helpful wizards and graphics designers.
Add-in Express 是 Visual Studio 用户的商业替代方案,用于 VSTO。它支持为各种 Office 产品制作插件,而不仅仅是 Excel,并且具有 helpful wizards 和图形设计师。 - Jens Thiel's ManagedXll was an established, commercial product to easily create .xll libraries in .NET. If ManagedXll were free, Excel-DNA would not exist.
Jens Thiel 的 ManagedXll 是一个成熟的商业产品,用于轻松创建 .xll 库。如果 ManagedXll 是免费的,Excel-DNA 就不会存在。 - Statfactory's NeXL are F# based connectors to get data from various platforms (Bloomberg, Quandl, Worldbank, IMF and the R language) into Excel.
Statfactory 的 NeXL 是基于 F#的连接器,可以从各种平台(Bloomberg、Quandl、Worldbank、IMF 和 R 语言)获取数据到 Excel 中。 - For making Excel Add-Ins in Python, have a look at PyXLL.
对于用 Python 开发 Excel Add-Ins,可以看看 PyXLL。 - There are a number of C/C++ libraries and tools that make creating .xlls easier than using the Excel SDK directly:
有许多 C/C++库和工具可以更容易地创建.xll 文件,而不是直接使用 Excel SDK:- I initially used the XLW open-source library.
我最初使用了 XLW 开源库。 - The XLL+ toolkit is a highly regarded commercial option.
XLL+工具包是一个备受推崇的商业选项。 - Keith Lewis has some modern C++ libraries for making .xlls, available on CodePlex at https://archive.codeplex.com/?p=xll.
Keith Lewis 有一些现代 C++库用于制作.xll 文件,可以在 CodePlex 上找到,网址为 https://archive.codeplex.com/?p=xll。
- I initially used the XLW open-source library.
Performance 性能
Information about the performance of Excel-DNA user-defined functions can be found on the Excel-DNA Performance page.
Excel-DNA 用户定义函数的性能信息可以在 Excel-DNA 性能页面上找到。
More Details 更多详情
Excel-DNA is developed using .NET, and users have to install the freely available .NET Framework runtime. The integration is by an Excel Add-In (.xll) that exposes .NET code to Excel. The user code can be in text-based (.dna) script files (C#, Visual Basic or F#), or compiled .NET libraries (.dll). Excel-DNA supports both the .NET runtime version 2.0 (which is used by .NET versions 2.0, 3.0 and 3.5) and version 4. Add-ins can target either version of the runtime, and concurrent loading of both runtime versions into an Excel instance is supported.
Excel-DNA 使用.NET 开发,用户需要安装免费提供的.NET 框架运行时。通过 Excel 插件(.xll)进行集成,该插件将.NET 代码暴露给 Excel。用户代码可以是基于文本的(.dna)脚本文件(C#、Visual Basic 或 F#),或编译的.NET 库(.dll)。Excel-DNA 支持.NET 运行时版本 2.0(用于.NET 版本 2.0、3.0 和 3.5)和版本 4。插件可以针对这两种运行时版本中的任意一种进行开发,并且 Excel 实例中同时加载这两种运行时版本是支持的。
Excel versions '97 through 2016 can be targeted with a single add-in. Advanced Excel features are supported, including multi-threaded recalculation (Excel 2007 and later), registration-free RTD servers (Excel 2002 and later) and customized Ribbon interfaces (Excel 2007 and 2010). There is support for integrated Custom Task Panes (Excel 2007 and later), offloading UDF computations to a Windows HPC cluster (Excel 2010 and later), and for the 64-bit versions of Excel 2010 and 2013.
Excel 97 至 2016 版本可以通过一个插件进行目标定位。支持高级 Excel 功能,包括多线程重算(Excel 2007 及以后版本),注册免费 RTD 服务器(Excel 2002 及以后版本)和自定义 Ribbon 界面(Excel 2007 和 2010)。支持集成自定义任务窗格(Excel 2007 及以后版本),将 UDF 计算卸载到 Windows HPC 群集(Excel 2010 及以后版本),以及 Excel 2010 和 2013 的 64 位版本。
Most managed UDF assemblies developed for Excel Services can be exposed to the Excel client with no modification. (Please contact me if you are interested in this feature.)
大多数为 Excel Services 开发的受管理的 UDF 组件可以在不修改的情况下暴露给 Excel 客户端。(如果您对此功能感兴趣,请联系我。)
Since Excel-DNA uses the Excel C API, porting C/C++ add-in code based on the Excel XLL SDK is very easy. (No more XLOPER
s!)
由于 Excel-DNA 使用了 Excel C API,基于 Excel XLL SDK 的 C/C++ 扩展代码移植非常容易。(不再有 XLOPER
了!)
The Excel-DNA Runtime is free for all use, and distributed under a permissive open-source license that also allows commercial use.
Excel-DNA 运行时免费用于所有用途,并以允许商业使用的宽松开源许可证分发。
Originally, the project was hosted on https://exceldna.codeplex.com, where you can still download the site in it's historic state as a package. After CodePlex' shutdown the archive site is however mostly unusable by now.
该项目最初托管在 https://exceldna.codeplex.com,您仍然可以在那里下载其历史状态的站点作为包。然而,随着 CodePlex 的关闭,存档站点现在已经大多无法使用。
Latest Releases 最新发布
The current version on NuGet is Excel-DNA Latest, released in October 2022.
当前在 NuGet 上的版本是 Excel-DNA Latest,发布于 2022 年 10 月。
Topics to Discuss Further
进一步讨论的主题
- Migrating to .NET 6 from .NET 4
从.NET 4 迁移到 .NET 6 - Excel-DNA Project Templates
Excel-DNA 项目模板 - Comparison with other tools
与其他工具的比较