להסיר שדות
Contents
[
Hide
]
לפעמים צריך להסיר שדה מן המסמך. זה יכול להתרחש כאשר יש להחליף אותו עם סוג שדה שונה או כאשר השדה כבר לא צריך במסמך. למשל TOC
שדה בעת שמירת HTML
כדי להסיר שדה מוכנס לתוך מסמך באמצעות 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.