필드 속성 찾기
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-Java | |
Document doc = new Document(getMyDir() + "Hyperlinks.docx"); | |
for (Field field : doc.getRange().getFields()) | |
{ | |
String fieldCode = field.getFieldCode(); | |
String fieldResult = field.getResult(); | |
} |
참고 문서에서 병합 필드의 이름만 찾는 경우 대신 기본 제공 메서드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-Java | |
Document doc = new Document(); | |
String[] fieldNames = doc.getMailMerge().getFieldNames(); |