フィールドプロパティの検索

Contents
[ ]

DocumentBuilderを使用して挿入されるフィールド。InsertFieldFieldオブジェクトを返します。 これは、フィールドのそのようなプロパティをすばやく見つけるための便利なメソッドを提供するファサードクラスです。

次のコード例は、フィールドコードとフィールド結果を検索する方法を示しています:

// For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Java
Document doc = new Document(getMyDir() + "Hyperlinks.docx");
for (Field field : doc.getRange().getFields())
{
String fieldCode = field.getFieldCode();
String fieldResult = field.getResult();
}

メモ文書内の差し込み項目の名前のみを探している場合は、代わりに組み込みメソッドGetFieldNamesを使用できます。

次のコード例は、ドキュメント内のすべての差し込み項目の名前を取得する方法を示しています。

// For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Java
Document doc = new Document();
String[] fieldNames = doc.getMailMerge().getFieldNames();