필드 제거
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-Java | |
Document doc = new Document(getMyDir() + "Various fields.docx"); | |
Field field = doc.getRange().getFields().get(0); | |
field.remove(); |
이 예제의 샘플 파일은 다음에서 다운로드할 수 있습니다 Aspose.Words GitHub.