Community articlewriteForm method
Added by IBM contributorIBM on July 26, 2013
Rate this article 1 starsRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars

Description

This method will write a form to the specified file or stream. Call this method on the root node of the form. The version number of the form determines the format of the output file. You can specify whether to compress the output file and whether to observe the transmit and save settings in the form.
If no format is specified, the default is to write the form in the same format in which it was read. If the form in question was created dynamically by your application, writeForm will, by default, write it as an XFDL form in uncompressed format.

Method

WRITING TO A FILE:
   public void writeForm(
      String theFilePath,
      FormNodeP triggerItem,
      int flags
   ) throws UWIException;

WRITING TO A STREAM:
   public void writeForm(
      OutputStream theStream,
      FormNodeP triggerItem,
      int flags
   ) throws UWIException;


WRITING TO A WRITER:
   public void writeForm(
      java.io.Writer theWriter,
      FormNodeP triggerItem,
      int flags
   ) throws UWIException;


Parameters

Table 1. Method parameters
ExpressionTypeDescription
theFilePathStringThis is the path to the file on the local disk to which the form will be written.
theStream OutputStreamThis is the stream to which you want to write the form data.
theWriter java.io.WriterThe Java Writer to which you want to write the form data.
triggerItemFormNodePThis is the item that caused the form to be submitted. Set to null if the API receives the form in a manner other than transmission.
flagsintThe following flags are valid:
FormNodeP.UFL_TRANSMIT_ALLOW allows the transmit options (that is, transmitdatagroups, transmitgroups, transmititemrefs, transmititems, transmitoptionrefs, transmitpagerefs and transmitoptions) to control which portions of the form are sent. Without this flag, the entire form will be sent regardless of the transmit options in the form.
FormNodeP.UFL_SAVE_ALLOW allows the saveformat option to specify what format the form should be saved in. If no format is specified then the form will be saved in the same format that it is read.
Note: Specify 0 if you do not want to enable any of the transmit options.


Returns

Returns nothing if the call is successful, or throws a generic exception (UWIException) if an error occurs.

Example

The following example uses writeForm to write the form in memory to a file on the local drive.
   private static void saveForm( ) throws Exception
   {
      theForm.writeForm("Output.xfd", null, 0);
   }


Parent topic:
FormNodeP class