com.aspose.words
Class FieldFormat

java.lang.Object
    extended by com.aspose.words.FieldFormat

public class FieldFormat 
extends java.lang.Object

Provides typed access to field's numeric, date and time, and general formatting.

Example:

Shows how to formatting fields
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

Field field = builder.insertField("MERGEFIELD Date");

FieldFormat format = field.getFormat();

format.setDateTimeFormat("dddd, MMMM dd, yyyy");
format.setNumericFormat("0.#");
format.getGeneralFormats().add(GeneralFormat.CHAR_FORMAT);

Property Getters/Setters Summary
java.lang.StringgetDateTimeFormat()
voidsetDateTimeFormat(java.lang.String value)
           Gets or sets a formatting that is applied to a date and time field result. Corresponds to the \@ switch.
GeneralFormatCollectiongetGeneralFormats()
           Gets a collection of general formats that are applied to a numeric, text or any field result. Corresponds to the \* switches.
java.lang.StringgetNumericFormat()
voidsetNumericFormat(java.lang.String value)
           Gets or sets a formatting that is applied to a numeric field result. Corresponds to the \# switch.
 

Property Getters/Setters Detail

getDateTimeFormat/setDateTimeFormat

public java.lang.String getDateTimeFormat() / public void setDateTimeFormat(java.lang.String value)
Gets or sets a formatting that is applied to a date and time field result. Corresponds to the \@ switch.

Example:

Shows how to formatting fields
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

Field field = builder.insertField("MERGEFIELD Date");

FieldFormat format = field.getFormat();

format.setDateTimeFormat("dddd, MMMM dd, yyyy");
format.setNumericFormat("0.#");
format.getGeneralFormats().add(GeneralFormat.CHAR_FORMAT);

getGeneralFormats

public GeneralFormatCollection getGeneralFormats()
Gets a collection of general formats that are applied to a numeric, text or any field result. Corresponds to the \* switches.

Example:

Shows how to formatting fields
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

Field field = builder.insertField("MERGEFIELD Date");

FieldFormat format = field.getFormat();

format.setDateTimeFormat("dddd, MMMM dd, yyyy");
format.setNumericFormat("0.#");
format.getGeneralFormats().add(GeneralFormat.CHAR_FORMAT);

getNumericFormat/setNumericFormat

public java.lang.String getNumericFormat() / public void setNumericFormat(java.lang.String value)
Gets or sets a formatting that is applied to a numeric field result. Corresponds to the \# switch.

Example:

Shows how to formatting fields
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

Field field = builder.insertField("MERGEFIELD Date");

FieldFormat format = field.getFormat();

format.setDateTimeFormat("dddd, MMMM dd, yyyy");
format.setNumericFormat("0.#");
format.getGeneralFormats().add(GeneralFormat.CHAR_FORMAT);

See Also:
          Aspose.Words Documentation - the home page for the Aspose.Words Product Documentation.
          Aspose.Words Support Forum - our preferred method of support.