フィールドプロパティの検索
Contents
[
Hide
]
DocumentBuilderを使用して挿入されるフィールド。InsertFieldはFieldオブジェクトを返します。 これは、フィールドのいくつかのプロパティをすばやく見つけるための便利なメソッドを提供するファサードクラスです。
次のコード例は、フィールドコードとフィールド結果を検索する方法を示しています:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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メソッドを使用できます。
次のコード例は、ドキュメント内のすべての差し込み項目の名前を取得する方法を示しています:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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(); |