infopath java包_预览和调试包含代码的 InfoPath 表单模板

预览和调试包含代码的 InfoPath 表单模板Preview and Debug InfoPath Form Templates with Code

11/16/2014

本文内容

使用带有 Visual Studio 2008 的 Microsoft InfoPath,您可以通过在预览模式下运行表单代码来进行调试。在开始调试表单代码时,系统将对项目进行编译,InfoPath 将在 InfoPath 预览窗口中显示表单。当遇到设置了断点的代码行时,焦点将移动到代码编辑器。当越过断点继续调试时,焦点将移回预览窗口。关闭预览窗口时调试也将停止。Microsoft InfoPath with Visual Studio 2012 enables debugging by running form code in preview mode. When you start debugging form code, your project is compiled and InfoPath displays your form in the InfoPath preview window. When a line of code that has a breakpoint set for it is encountered, the focus moves to the code editor. When you continue past a breakpoint, the focus moves back to the preview window. Debugging stops when you close the preview window.

还可以修改表单模板的表单选项,以便使用特定的用户角色或示例数据文件或者通过指定表单将发布到的域来进行预览和调试。You can also modify the form options of the form template to preview and debug using a specific user role, a sample data file, or by specifying the domain to which the form will be published.

备注

在部署表单模板之后,不能在运行时从 Visual Studio 2008 调试这些表单模板。It is not possible to debug form templates after they are deployed at run time from Visual Studio 2012. 这适用于只与 InfoPath 兼容的表单模板以及与 InfoPath 和使用 InfoPath Forms Services 的 Web 浏览器兼容的表单模板。This includes form templates that are compatible only with InfoPath, as well as those that are compatible with InfoPath and the Web browser using InfoPath Forms Services. 但是,可以在运行时通过代码将值记录到某个域,以帮助调试表单模板的业务逻辑。However, it is possible to log values to a field from code at run time to help with debugging a form template's business logic. 有关如何执行此操作的信息,请参阅将值记录到字段中进行调试。For information about how to do that, see Log Values to a Field for Debugging.

在预览模式下调试Debugging in Preview Mode

在预览模式下调试 InfoPath 项目To debug an InfoPath project in Preview Mode

在 Visual Studio 2008 中创建或打开 InfoPath 托管代码表单模板。Create or open an InfoPath managed code form template in Visual Studio 2012.

在代码编辑器中,通过单击要插入断点的代码行左侧的灰条在表单代码中设置一个或多个断点。Set one or more breakpoints in your form code in the code editor by clicking the grey bar to the left of the line of code where you want to insert a breakpoint.

将显示一个红色圆圈,并且该代码行突出显示,指示运行时将在表单代码中的此断点处暂停。A red circle is displayed and the line of code is highlighted to indicate that the runtime will pause at this breakpoint in your form code.

在“调试”**** 菜单上,单击“启动调试”****,或按 F5。On the Debug menu, click Start Debugging; or press F5.

将对项目进行编译,并在预览窗口中显示表单。The project will be compiled and the form is displayed in the preview window.

与表单进行交互,直到遇到包含断点的一行代码。Interact with the form until a line of code containing a breakpoint is encountered.

焦点将返回到代码编辑器。The focus returns to the code editor.

在“调试”**** 菜单上,单击“继续”****,或按 F5。On the Debug menu, click Continue; or press F5.

完成调试后,关闭预览窗口,或在“调试”**** 菜单上,单击“停止调试”****。When you are finished debugging, close the preview window; or on the Debug menu, click Stop Debugging.

备注

要在使用需要完全信任的对象模型成员时调试 InfoPath 托管代码表单模板,必须按照预览和调试需要完全信任的表单模板中的说明配置你的表单模板。To debug an InfoPath managed code form template when using an object model member that requires full trust, you must configure your form template as described in Preview and Debug Form Templates that Require Full Trust.

使用示例数据文件Using a Sample Data File

默认情况下,调试和预览使用在创建表单模板时创建的 template.xml 文件。您可以创建自己的数据文件,并按照以下过程之一指定在预览或调试过程中使用该文件。By default, debugging and previewing uses the template.xml file that is created when a form template is created. You can create your own data file and specify to use it when previewing or debugging by using one of the following procedures.

指定在 Visual Studio Tools for Applications 中调试或预览时使用的示例数据文件To specify a sample data file to use while debugging or previewing in Visual Studio Tools for Applications

要查看 template.xml,请在 InfoPath 设计模式下打开表单模板。To view template.xml, open the form template in InfoPath design mode.

依次单击“文件”**** 选项卡、“保存”****、“将表单模板另存为”**** 和“源文件”****。Click the File tab, click Saving, click Save Form Template As, and the click Source Files.

将表单模板文件保存到一个文件夹中,然后在文本编辑器中打开该 template.xml 文件。Save the form template files to a folder, and then open the template.xml file in a text editor.

利用要使用的示例数据创建并保存与 template.xml 具有相同结构的文件。Create and save a file with the same structure as template.xml with the sample data you want to use.

单击“文件”**** 选项卡,然后单击“信息”**** 选项卡上的“表单选项”****。Click the File tab, and then click Form Options on the Info tab.

单击“表单选项”**** 对话框中的“预览”**** 类别,然后在“示例数据”**** 下的“文件位置”**** 框中指定您创建的示例数据文件。Click the Preview category of the Form Options dialog box, and then under Sample data specify the sample data file you created in the File location box.

指定调试或预览过程中使用的用户角色Specifying a User Role to Use While Debugging or Previewing

如果正在使用的表单已定义了用户角色,则可以指定在调试或预览表单时使用的用户角色。有关如何定义用户角色的信息,请在 InfoPath 帮助中搜索"用户角色"。If the form you are working with has user roles defined for it, you can specify a user role to use while debugging or previewing your form. For information on how to define user roles, search InfoPath help for "user role".

备注

The option to specify a user role is not available if the compatibility setting for your form template is set to Web Browser Form. User roles are not supported in form templates opened in the browser from InfoPath Forms Services.The option to specify a user role is not available if the compatibility setting for your form template is set to Web Browser Form. User roles are not supported in form templates opened in the browser from InfoPath Forms Services.

指定在调试或预览过程中使用的角色To specify a role to use while debugging or previewing

如果您在 Visual Studio 2008 中工作,请切换到 InfoPath Designer。If you are working in Visual Studio 2012, switch to the InfoPath designer.

单击“文件”**** 选项卡,然后单击“信息”**** 选项卡上的“表单选项”****。Click the File tab, and then click Form Options on the Info tab.

单击“表单选项”**** 对话框中的“预览”**** 类别,然后在“以以下角色预览”**** 下拉框中指定要使用的用户角色。Click the Preview category of the Form Options dialog box, and then specify the user role to use in the Preview as drop-down box.

指定在调试或预览过程中使用的域Specifying a Domain to Use While Debugging or Previewing

可以预览表单,就像该表单已发布到某个特定域一样。仅当表单模板的安全级别明确设置为“域”**** 时,此设置才适用。You can preview a form as if it was published to a specific domain. This setting will only apply if the security level of the form template is explicitly set to Domain.

指定在调试或预览过程中要使用的域To specify a domain to use while debugging or previewing

如果您在 Visual Studio 2008 中工作,请切换到 InfoPath Designer。If you are working in Visual Studio 2012, switch to the InfoPath designer.

单击“文件”**** 选项卡,然后单击“信息”**** 选项卡上的“表单选项”****。Click the File tab, and then click Form Options on the Info tab.

单击“表单选项”**** 对话框中的“预览”**** 类别,然后在“域”**** 框中指定要在预览和调试过程中使用的域。Click the Preview category of the Form Options dialog box, and then specify the domain to use while previewing and debugging in the Domain box.

单击“表单选项”**** 对话框中的“安全和信任”**** 类别,清除“自动确定安全级别”**** 复选框,然后单击“域”****。Click the Security and Trust category of the Forms Options dialog box, clear the Automatically determine security level check box, and then click Domain.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值