FormLayout

Native C API

Overview

A FormLayout is a document which was created with TFORMer Designer. Use the native C repository functions to inspect FormLayout information; see TFormer_GetFirstFormIt.

A typical FormLayout contains static content (like a logo), dynamic content (like a DataField) and a number of properties which are used to describe the FormLayout and its behavior during print-time. Each FormLayout is member of exactly one Project (in the case of a Repository) or the GlobalProject (in the case of a stand-alone FormLayout).

Note

It is not possible to change the appearance of the FormLayout (like adding new elements or bands) through the SDK. Design tasks are supported by TFORMer Designer only.

Repository-based FormLayouts


General

Printing

When printing a specific FormLayout within a Repository 3 parameters must be specified to identify the FormLayout:

Stand-Alone FormLayout

General

Printing

When printing a Job using a stand-alone FormLayout 1 parameter must be specified:

Note

Do not use TFormer_SetProjectName and TFormer_SetFormName when using a stand-alone FormLayout!

Determining Used DataFields


To iterate through the available data-fields, use TFormer_GetFirstProjectVarIt and TFormer_GetNextProjectVarIt. If you want to know, whether the returned DataField is actually used you can use the method TFormer_ProjectVarItGetUsage.

Sample

To inspect a stand-alone FormLayout:

  ERRCODE         eCode             = ErrOk;
  HFORM_ITERATOR  itForm            = NULL;
  LPCSTR          pszFormDescription= NULL;
  BOOL            bFormValid        = FALSE;

  // Retrieve first form of the global Project   
  // A stand-alone FormLayout contains only the global Project, the global Project contains the FormLayout  
  LPCSTR          pszProjectName    = NULL; // use global project

  // Retrieve the first (and only) FormLayout
  itForm      = TFormer_GetFirstFormIt (hTForm, pszProjectName, &eCode);
  bFormValid  = (itForm != NULL);

  if (bFormValid && eCode == ErrOk)
  {
    pszFormDescription = TFormer_FormItGetDescription (itForm, &eCode);
    printf ("description: ");
    if (pszFormDescription != NULL && eCode == ErrOk)
      printf (pszFormDescription);
    printf ("\n");
  }    

  // release iterator
  TFormer_FreeFormIt (itForm);

To iterate the FormLayouts in a Repository:

  ERRCODE           eCode           = ErrOk;
  HPROJECT_ITERATOR itProject       = NULL;
  BOOL              bProjectValid   = FALSE;
  LPCSTR            pszProjectName  = NULL;
  HFORM_ITERATOR    itForm          = NULL;
  BOOL              bFormValid      = FALSE;
  LPCSTR            pszFormName     = NULL;    

  // Retrieve the first Project 
  itProject     = TFormer_GetFirstProjectIt (hTForm, &eCode);  
  bProjectValid = (itProject != NULL);

  // TYPE_E_ELEMENTNOTFOUND should not be treated as error
  if (eCode == TYPE_E_ELEMENTNOTFOUND)
    eCode = ErrOk;

  while (bProjectValid && eCode == ErrOk)
  {
    pszProjectName = TFormer_ProjectItGetName (itProject, &eCode);

    if (pszProjectName != NULL && eCode == ErrOk)
    {
      printf ("project name: '%s'\n", pszProjectName);

      itForm    = TFormer_GetFirstFormIt (hTForm, pszProjectName, &eCode);
      bFormValid= (itForm != NULL);

      // TYPE_E_ELEMENTNOTFOUND should not be treated as error
      if (eCode == TYPE_E_ELEMENTNOTFOUND)
        eCode = ErrOk;

      while (bFormValid && eCode == ErrOk)
      {
        pszFormName = TFormer_FormItGetName (itForm, &eCode);

        if (pszFormName != NULL && eCode == ErrOk)
          printf ("  form name: '%s'\n", pszFormName);

        // Get the next FormLayout in this Project
        bFormValid = (TFormer_GetNextFormIt (itForm) == ErrOk);
      }

      TFormer_FreeFormIt (itForm);
    }

    // Get the next Project
    bProjectValid = (TFormer_GetNextProjectIt (itProject) == ErrOk);
  }

  TFormer_FreeProjectIt (itProject);  

Search documentation

Search in
More scopes
Additional scopes

All contents