필드 속성 찾기

Contents
[ ]

DocumentBuilder.InsertField를 사용하여 삽입된 필드는 Field 객체를 반환합니다. 이는 필드의 일부 속성을 빠르게 찾는 데 유용한 메서드를 제공하는 faсade 클래스입니다.

다음 코드 예제에서는 필드 코드와 필드 결과를 찾는 방법을 보여줍니다

// For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-.NET
Document doc = new Document(MyDir + "Hyperlinks.docx");
foreach (Field field in doc.Range.Fields)
{
string fieldCode = field.GetFieldCode();
string fieldResult = field.Result;
}

문서에서 병합 필드의 이름만 찾는 경우 내장된 GetFieldNames 방법을 대신 사용할 수 있습니다.

다음 코드 예제에서는 문서의 모든 병합 필드 이름을 가져오는 방법을 보여줍니다

// For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-.NET
Document doc = new Document();
string[] fieldNames = doc.MailMerge.GetFieldNames();