Visio.RequestContext class
RequestContext 对象可方便对 Visio 应用程序提出请求。 由于 Office 加载项和 Visio 应用程序在两个不同的进程中运行,因此需要请求上下文才能从外接程序访问 Visio 对象模型。
注解
使用方
- Visio: 运行
- Visio.Application: context
- Visio.Comment: context
- Visio.CommentCollection: context
- Visio.Document: context
- Visio.DocumentView: context
- Visio.Hyperlink: context
- Visio.HyperlinkCollection: context
- Visio.Page: context
- Visio.PageCollection: context
- Visio.PageView: context
- Visio.Selection: context
- Visio.Shape: context
- Visio.ShapeCollection: context
- Visio.ShapeDataItem: context
- Visio.ShapeDataItemCollection: context
- Visio.ShapeView: context
示例
// *.run methods automatically create an OfficeExtension.ClientRequestContext
// object to work with the Office file.
Visio.run(session, function (context) {
const activePage = context.document.getActivePage();
// Interact with the Visio page...
return context.sync();
}).catch(function(error) {
console.log("Error: " + error);
if (error instanceof OfficeExtension.Error) {
console.log("Debug info: " + JSON.stringify(error.debugInfo));
}
});
构造函数
| (constructor)(url) | 构造 类的新实例 |
属性
| document |
构造函数详细信息
(constructor)(url)
构造 类的新实例RequestContext
constructor(url?: string | OfficeExtension.EmbeddedSession);
参数
- url
-
string | OfficeExtension.EmbeddedSession