如何在 C# 中将 'public partial class ThisWorkbook' 添加到 VSTO 应用程序?
How do you add a 'public partial class ThisWorkbook' to a VSTO application in C#?
我正在尝试将 ActionPane
添加到 Excel VSTO 加载项。我需要访问 ThisWorkbook.ActionsPane
集合来添加我的操作面板。
Microsoft 文档位于:
说:
To show the actions pane, add the user control to the Controls
property of the ThisDocument.ActionsPane
field (Word) or
ThisWorkbook.ActionsPane
field (Excel).
Add the following code to the ThisDocument
or ThisWorkbook
class as a
class-level declaration (do not add this code to a method).
这意味着我需要向 VSTO 解决方案添加 ThisWorkbook
class。我的问题是:
哪个基础 class 包含 ActionsPlane
集合?
我如何将从这个基础 class 派生的 class 添加到我的 VSTO?
一些 ThisWorkbook
class 的在线示例包含设计器生成的区域。
我的工作量包括每个可用的 VSTO 项目。 Visual Studio 2019 年 'Add New Item' 或 'Add New User Control' 下根本没有 Excel 项目。除了功能区栏之外,没有 VSTO 的设计器。
我看到的唯一方法是手动添加 ThisWorkbook
class。
我说 Visual Studio 以前版本中可能存在的任何设计师在 Visual Studio 2019 中不再存在,我说得对吗?
您需要区分文档级和应用程序级加载项。
操作窗格是一个可自定义的文档操作任务窗格,附加到特定的 Microsoft Office Word 文档或 Microsoft Office Excel 工作簿。操作窗格与其他内置任务窗格一起托管在 Office 任务窗格中,例如 Excel 中的 XML 源任务窗格或 Word 中的样式和格式任务窗格。您可以使用 Windows Forms 控件或 WPF 控件来设计操作窗格用户界面。
如果您正在开发文档级加载项,请阅读 How to: Add an Actions Pane to Word Documents or Excel Workbooks 文章中有关操作窗格的更多信息。
如果您正在开发应用程序级加载项,您可能有兴趣使用 Custom task panes. Task panes are user interface panels that are typically docked to one side of a window in a Microsoft Office application. Custom task panes give you a way to create your own task pane and provide users with a familiar interface to access your solution's features. For example, the interface can contain controls that run code to modify documents or display data from a data source. See Walkthrough: Automate an application from a custom task pane 快速入门。
我正在尝试将 ActionPane
添加到 Excel VSTO 加载项。我需要访问 ThisWorkbook.ActionsPane
集合来添加我的操作面板。
Microsoft 文档位于:
说:
To show the actions pane, add the user control to the Controls property of the
ThisDocument.ActionsPane
field (Word) orThisWorkbook.ActionsPane
field (Excel).
Add the following code to the
ThisDocument
orThisWorkbook
class as a class-level declaration (do not add this code to a method).
这意味着我需要向 VSTO 解决方案添加 ThisWorkbook
class。我的问题是:
哪个基础 class 包含
ActionsPlane
集合?我如何将从这个基础 class 派生的 class 添加到我的 VSTO?
一些
ThisWorkbook
class 的在线示例包含设计器生成的区域。我的工作量包括每个可用的 VSTO 项目。 Visual Studio 2019 年 'Add New Item' 或 'Add New User Control' 下根本没有 Excel 项目。除了功能区栏之外,没有 VSTO 的设计器。
我看到的唯一方法是手动添加
ThisWorkbook
class。我说 Visual Studio 以前版本中可能存在的任何设计师在 Visual Studio 2019 中不再存在,我说得对吗?
您需要区分文档级和应用程序级加载项。
操作窗格是一个可自定义的文档操作任务窗格,附加到特定的 Microsoft Office Word 文档或 Microsoft Office Excel 工作簿。操作窗格与其他内置任务窗格一起托管在 Office 任务窗格中,例如 Excel 中的 XML 源任务窗格或 Word 中的样式和格式任务窗格。您可以使用 Windows Forms 控件或 WPF 控件来设计操作窗格用户界面。
如果您正在开发文档级加载项,请阅读 How to: Add an Actions Pane to Word Documents or Excel Workbooks 文章中有关操作窗格的更多信息。
如果您正在开发应用程序级加载项,您可能有兴趣使用 Custom task panes. Task panes are user interface panels that are typically docked to one side of a window in a Microsoft Office application. Custom task panes give you a way to create your own task pane and provide users with a familiar interface to access your solution's features. For example, the interface can contain controls that run code to modify documents or display data from a data source. See Walkthrough: Automate an application from a custom task pane 快速入门。