Use Microsoft Office infopath in combination with C # Programming

Source: Internet
Author: User
Tags xslt

I think it is most convenient to use web services to interact with infopath. infopath can only extract data from databases (SQL Server and access), rather than directly edit data. Through the web service, infopath submits XML data for further data processing. Infopath pages can also be beautiful, which is equivalent to web pages.

However, the original physical path is saved in the template generated by infopath. If you copy the template file to another host, the form cannot be opened. What is the problem?

After studying infopath for a while, it is very convenient to use it. When designing a template, you can add verification conditions and custom rules for each of its controls, which is convenient to operate, even if you do not understand programming.

Infopath 2003 toolkit for Visual Studio. NET, a component found on the Internet, can be integrated with the. NET Framework and can be used to edit background code in C # to expand the functions of the program. After the installation is successful, a new project type is created in Microsoft Visual Studio. NET 2003. For example:

Click this link to download. infopath 2003 toolkit for Visual Studio. NET.

 

Example: C # background code

Using system;

Using system. Web;

Using system. Web. UI;

Using Microsoft. Office. InterOP. infopath. semitrust;

 

// Office integration attribute, indicating the startup class of the form. Do not modify.

[Assembly: system. componentmodel. descriptionattribute ("infopathstartupclass, version = 1.0, class = infopathproject1.infopathproject1")]

 

Namespace infopathproject1

{

// The namespace prefix defined in the attribute must be synchronized with the form definition file (. xsf.

[Infopathnamespace ("xmlns: xdutil =/" http://schemas.microsoft.com/office/infopath/2003/xslt/Util"

Xmlns: xdxdocument =/"http://schemas.microsoft.com/office/infopath/2003/xslt/xDocument"

Xmlns: XD =/"http://schemas.microsoft.com/office/infopath/2003"

Xmlns: My =/"http://schemas.microsoft.com/office/infopath/2003/myXSD/ 2006-03-15 T02: 16: 17 /"

Xmlns: msxsl =/"urn: Schemas-Microsoft-com: XSLT/" xmlns: xdmath =/"http://schemas.microsoft.com/office/infopath/2003/xslt/Math"

Xmlns: xsf =/"http://schemas.microsoft.com/office/infopath/2003/solutionDefinition"

Xmlns: xddate =/"http://schemas.microsoft.com/office/infopath/2003/xslt/Date"

Xmlns: xsi =/"http://www.w3.org/ 2001 /XMLSCHEMA-instance/"")]

Public class infopathproject1

{

Private xdocument thisxdocument;

Private application thisapplication;

 

Public void _ startup (Application app, xdocument DOC)

{

Thisxdocument = Doc;

Thisapplication = app;

 

// You can add other initialization code here.

}

Public void _ Shutdown ()

{

}

}

}

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.