[英]How do I programmatically close an InfoPath form in C#?
Is it possible to close an InfoPath form programmatically? 是否可以通过编程方式关闭InfoPath表单? I know that it can be configured as a form rule / action but I want to close the form via code. 我知道它可以配置为表单规则/操作但我想通过代码关闭表单。
Use the ApplicationClass.XDocuments.Close method and pass it your document object: 使用ApplicationClass.XDocuments.Close方法并将其传递给您的文档对象:
using System;
using Microsoft.Office.Interop.InfoPath;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
var app = new ApplicationClass();
var uri = @".\form1.xml";
var doc = app.XDocuments.Open(uri, 0);
app.XDocuments.Close(doc);
}
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.