Share via


SolutionObject 接口

对应于 InfoPath 表单模板。

命名空间:  Microsoft.Office.Interop.InfoPath.SemiTrust
程序集:  Microsoft.Office.Interop.InfoPath.SemiTrust(位于 Microsoft.Office.Interop.InfoPath.SemiTrust.dll 中)

语法

声明
<GuidAttribute("096cd557-0786-11d1-95fa-0080c78ee3bb")> _
Public Interface SolutionObject _
    Inherits Solution
用法
Dim instance As SolutionObject
[GuidAttribute("096cd557-0786-11d1-95fa-0080c78ee3bb")]
public interface SolutionObject : Solution

备注

此类型是用于 Coclass(托管代码需要此 Coclass 来实现 COM 互操作性)的包装。使用此类型来访问由此 Coclass 实现的 COM 接口。有关 COM 接口的信息(包括指向其成员说明的链接),请参阅Solution.

Using the members of the Solution interface provides compatibility with InfoPath 2003. To use new members that were added to the Solution2 object model in InfoPath 2010, you must cast the object returned by the Solution property of the XDocument object to the Solution2 type. For more information, see 如何:使用与 InfoPath 2003 不兼容的 Microsoft.Office.Interop.InfoPath.SemiTrust 成员.

SolutionObject 对象实现的属性用以获得表单模板的信息,包括版本号、已提取表单文件的统一资源定位器 (URL)、模板加载来源的 URL 以及包含表单定义文件 (.xsf) 的 XML 文档对象模型 (DOM)。

可通过 XDocument 对象的 Solution 属性访问 SolutionObject 对象。

示例

在以下示例中,设置了对 Solution 对象的引用,然后代码使用 Solution 对象的 DOM 属性,从 .xsf 文件中获得表单作者的姓名。然后进行测试,以确定是否有作者的值,并在消息框中显示结果。

[InfoPathEventHandler(MatchPath="SolutionInfo", EventType=InfoPathEventType.OnClick)]
public void SolutionInfo_OnClick(DocActionEvent e)
{
 Solution solution = thisXDocument.Solution;
 string solutionVersion = solution.Version;
 string authorText;
 IXMLDOMNode author = solution.DOM.selectSingleNode("xsf:xDocumentClass/@author");
  
 if (author != null)
 {
  authorText = author.text;
 }
 else
 {
  authorText = "Author not available.";
 }

 thisXDocument.UI.Alert("Version: " + solutionVersion + "\nAuthor: " + authorText);
}

另请参阅

引用

SolutionObject 成员

Microsoft.Office.Interop.InfoPath.SemiTrust 命名空间