フィールドの削除
Contents
[
Hide
]
ドキュメントからフィールドを削除する必要がある場合があります。 これは、別のフィールドタイプに置き換える必要がある場合、またはドキュメント内でフィールドが不要になった場合に発生する可能性があります。 たとえば、HTMLに保存するときのTOC
フィールド。
DocumentBuilderを使用して文書に挿入されたフィールドを削除します。InsertFieldは、返されたFieldオブジェクトを使用して、文書からフィールドを簡単に削除するための便利なRemoveメソッドを提供します。
次のコード例は、ドキュメントからフィールドを削除する方法を示しています:
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 + u"Various fields.docx"); | |
SharedPtr<Field> field = doc->get_Range()->get_Fields()->idx_get(0); | |
field->Remove(); |