Overview of the GenerateFormXML Code Sample

The GenerateFormXML application will convert your form to Nintex form XML that can be uploaded to a SharePoint list where you can define and create columns to bind to the form.

The sample demonstrates how to take input (in this case a bare-bones XML file), to create Nintex complex XML elements that describe valid XML for Nintex Forms.

Notes on Nintex Forms XML

The Nintex Forms XML is composed of three main types of XML fragments:

The control properties and layout are both used to define a single control. They are linked together with a control .Net Guid.

For more information about Nintex Forms XML, see XML Reference.

Process for Generating the Form XML

The application ingest the bare-bones XML, and then iterates over each control.

For each control:

  1. The application loads the height, width, the text element. For specific controls such as the ListBox, the application loads the list of options. For the image, the application loads the image URL. The application also generates a Guid to link the control properties to the control layout.
  2. The application then loads the XML fragment for the control properties, updates the values of the target XML elements, and then inserts into the control properties section.
  3. The application then creates a control layout object, updates the layout attributes, serializes the object, and inserts the XML into the control layout section.
  4. The last step of the control iteration is to update the x and y coordinates of the layout for the next control. The layout proceeds from right to left, starting at (0,0) and fitting each control to the prior until a row of controls reaches the right margin at 700 pixels. Then the layout routine advances to the next line. Note, the routine doesn't check for overlap along the y-axis which can result in overlapping controls.

When the application completes iterating over the control, the application turns the XML into turned into text, and removes a stray namespace fragment generated in the serializing the control layout object.

Finally, the form is saved to the target location.

Related information

Generate Form XML

Author a Bare-bones Form XML Document

Prepare the GenerateFormXML Code Sample

Load the Generated Form XML