Ejemplo n.º 1
0
  public boolean areFieldsRight() {

    String birthdayDate = null;

    birthdayDate = form.getBirthdayDate();

    if (!FieldsHelper.checkDate(birthdayDate, FieldsHelper.DATE_FORMAT)) {
      lb1.setText(ln.getString("please_insert_a_valid_birthday_date"));
      return false;
    }

    return true;
  }
  public static void main(String[] args) throws Exception {
    // The path to the documents directory.
    String dataDir = Utils.getDataDir(ConvertFieldsInParagraph.class);

    Document doc = new Document(dataDir + "TestFile.doc");

    // Pass the appropriate parameters to convert all IF fields to static text that are encountered
    // only in the last
    // paragraph of the document.
    FieldsHelper.convertFieldsToStaticText(
        doc.getFirstSection().getBody().getLastParagraph(), FieldType.FIELD_IF);

    // Save the document with fields transformed to disk.
    doc.save(dataDir + "TestFileParagraph Out.doc");

    System.out.println("Converted fields in the paragraph with text successfully.");
  }