הסרת שדות
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-C | |
auto doc = MakeObject<Document>(MyDir + u"Various fields.docx"); | |
SharedPtr<Field> field = doc->get_Range()->get_Fields()->idx_get(0); | |
field->Remove(); |