IInfoPathViewControl 接口
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
表示视图中存在的控件。
public interface class IInfoPathViewControl
[System.Runtime.InteropServices.Guid("096CD6DA-0786-11D1-95FA-0080C78EE3BB")]
[System.Runtime.InteropServices.InterfaceType(1)]
public interface IInfoPathViewControl
type IInfoPathViewControl = interface
Public Interface IInfoPathViewControl
- 属性
示例
在以下示例中,IInfoPathDataImporter 接口的 Import 方法用于循环访问 mshtml。活动窗体视图中 IInfoPathViewControl 控件的 IEnumUnknown 集合。
导入例程是用于生成自定义数据导入程序的解决方案的主要部分。 Visual Studio 项目需要对 Microsoft Office InfoPath 2.0 类型库和 System.Windows.Forms 的引用,以及针对每个项的 Imports 语句以及 mshtml。实现 语句需要为自定义数据导入程序接口提供的方法(包括 IInfoPathDataImporter、 IInfoPathDataImporterFields、 IInfoPathViewControl和 IPropertyBag)生成签名。
注意:若要使用 .NET 类库生成自定义数据导入程序,请选中类属性编辑器的“编译”选项卡上的“注册 COM 互操作”复选框。
注意:若要调试自定义数据导入程序,请在 Visual Studio 中将“启动操作”设置为“启动外部程序”,然后浏览到位于驱动器>:\Program Files\Microsoft Office\Office12\的<INFOPATH.EXE。 此选项在类属性编辑器的“调试”选项卡上可用。
Imports Microsoft.Office.Interop.InfoPath
Imports System.Windows.Forms
Imports mshtml
<ComClass(Class1.ClassId, Class1.InterfaceId, Class1.EventsId)> Public Class Class1
Implements Microsoft.Office.Interop.InfoPath.IInfoPathDataImporter
Implements Microsoft.Office.Interop.InfoPath.IInfoPathDataImporterFields
Implements Microsoft.Office.Interop.InfoPath.IInfoPathViewControl
Implements Microsoft.Office.Interop.InfoPath.IPropertyBag
Public Const ClassId As String = _
"1FEB0DF8-E7F1-4b21-A9EE-B06D5FECC572"
Public Const InterfaceId As String = _
"9F9F685C-71A0-46ec-A7F9-A86AF8CBC2A8"
Public Const EventsId As String = _
"ED7C0C49-3F89-40a2-A50E-C59E8F682B08"
Public Sub Import(
_ByVal pPrintSettings As Microsoft.Office.Interop.InfoPath.IPropertyBag, _
ByVal punkViewControls As mshtml.IEnumUnknown) _
Implements Microsoft.Office.Interop.InfoPath.IInfoPathDataImporter.Import
Dim pControl As IInfoPathViewControl
Dim pUnk As Object
Dim pcelt As UInt16 = 1
Dim pceltFetched As UInt16 = 0
Try
'Gets first control in the view
punkViewControls.RemoteNext(pcelt, pUnk, pceltFetched)
Do While pUnk.ToString() <> "Nothing"
pControl = pUnk
MessageBox.Show(pControl.ControlType)
'Gets next control in the view
punkViewControls.RemoteNext(pcelt, pUnk, pceltFetched)
Loop
Catch e As Exception
If e.Message = _
"Object reference not set to an instance of an object." Then
' Signals the end of the enumeration/controls in the view
Else
MessageBox.Show("Error: " & e.ToString & " " & e.Message)
End If
End Try
End Sub
注解
与 接口结合使用的 IInfoPathViewControl 接口允许开发人员获取有关视图中控件的特定信息,例如 ControlType 和 DataType、Top和 Left 位置、与控件关联的 XML NodeName 以及 InputScopes(IntPtr, UInt32, IEnumString, String)。IInfoPathDataImporter 属性 Value 是唯一可以设置的属性。
有关在视图中存在的情况下枚举的控件的列表,请参阅 GetControls(IEnumUnknown) 接口的 IInfoPathDataImporterFields 方法。 有关可与特定控件一起使用的可接受数据类型的列表,请参阅 ValueIInfoPathViewControl 接口的 属性。
有关以编程方式将数据导入 InfoPath 表单的详细信息,请参阅 InfoPath 开发人员门户Microsoft Office 开发人员中心。
属性
| ControlType |
获取枚举中当前控件的控件类型。 |
| DataType |
获取视图中控件的数据类型。 |
| Height |
获取枚举中当前控件的高度。 |
| Left |
从视图左侧获取枚举中当前控件的偏移量。 |
| NodeName |
获取与枚举中的当前控件关联的节点的名称。 |
| Top |
从视图顶部获取枚举中当前控件的偏移量。 |
| Value |
获取或设置枚举中当前控件的值。 |
| Width |
获取枚举中当前控件的宽度。 |
方法
| InputScopes(IntPtr, UInt32, IEnumString, String) |
获取枚举中当前控件的输入范围。 |