Find Field Properties
שדה שמוכנס באמצעות 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(); |