Building forms programmatically

Aspose.OMR allows you to describe the layout and content of an OMR form directly in the application code. Although it takes much more coding than generating forms from text or JSON sources, this approach works best when you need to design forms with personalized fields such as a respondent’s name or a unique QR code.

Form object

The form is described as an instance of TemplateConfig class. All internal elements are nested inside this object.

You must also define at least one page as an instance of PageConfig class.

Basic form structure

The following code generates an empty single-page OMR form:

TemplateConfig templateConfig = new TemplateConfig() {
	Children=new List<BaseConfig>() {
		new PageConfig() {
			Children = new List<BaseConfig>() {
				/*
				 * Describe form content here
				 */
			}
		}
	}
};

You can use multiple PageConfig objects to separate the content of a large form into several pages.

Elements

Aspose.OMR offers a wide range of elements that allow you to create forms of any complexity - from a simple ballot to high school exam papers and finance application checklists.

  • Layout
    Arrange other elements; define the appearance and design of OMR forms.
  • Questionnaires
    Build OMR-ready surveys, ballots, checklists, and similar forms.
  • Answer sheets
    Populate a form with a grid of bubbles representing answers to an exam, test, or assessment.
  • Barcodes and QR codes
    Add barcodes and QR-codes to personalize or uniquely identify a form.
  • WriteInConfig
    Provide a blank field in which the respondent can hand write some text or draw a picture.

Examples

Check out code examples to see how different elements can be used and combined with each other.