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

Contents
[ ]

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

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

//For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-C
auto doc = MakeObject<Document>(MyDir + "Hyperlinks.docx");
for(const auto& field : doc->get_Range()->get_Fields())
{
auto fieldCode = field->GetFieldCode();
auto fieldResult = field->get_Result();
}

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

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

//For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-C
auto doc = MakeObject<Document>();
ArrayPtr<String> fieldNames = doc->get_MailMerge()->GetFieldNames();