עבודה עם טקסט מקושר
In In In Aspose.Words, The The TextBox הכיתה משמשת כדי לציין כיצד טקסט מוצג בתוך צורה. זה מספק נכס ציבורי בשם ההורה כדי לקבל את הצורה ההורה עבור תיבת הטקסט כדי לאפשר ללקוח למצוא מקושר Shape מקושר TextBox.
ליצור קישור
The The The TextBox הכיתה מספקת IsValidLinkTarget שיטה כדי לבדוק אם TextBox יכול להיות קשור למטרה Textbox.
דוגמה לקוד הבא מראה כיצד לבדוק אם TextBox
ניתן לקשר לתיבת טקסט היעד:
// For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Java | |
Document doc = new Document(); | |
Shape shape1 = new Shape(doc, ShapeType.TEXT_BOX); | |
Shape shape2 = new Shape(doc, ShapeType.TEXT_BOX); | |
TextBox textBox1 = shape1.getTextBox(); | |
TextBox textBox2 = shape2.getTextBox(); | |
if (textBox1.isValidLinkTarget(textBox2)) | |
textBox1.setNext(textBox2); |
בדוק טקסט Box Sequence
ישנן מספר דרכים להציג טקסט בצורה. The The The TextBox יכול להיות ראש, ביניים או Tail של רצף.
דוגמה לקוד הבא מראה כיצד לבדוק אם TextBox הוא ראש, Tail או Middle of theרצף:
// For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Java | |
Document doc = new Document(); | |
Shape shape = new Shape(doc, ShapeType.TEXT_BOX); | |
TextBox textBox = shape.getTextBox(); | |
if ((textBox.getNext() != null) && (textBox.getPrevious() == null)) { | |
System.out.println("The head of the sequence"); | |
} | |
if ((textBox.getNext() != null) && (textBox.getPrevious() != null)) { | |
System.out.println("The Middle of the sequence."); | |
} | |
if ((textBox.getNext() == null) && (textBox.getPrevious() != null)) { | |
System.out.println("The Tail of the sequence."); | |
} |
לשבור קישור
באמצעות BreakForwardLink שיטה שאתה יכול לשבור את הקישור הבא TextBox.
דוגמה לקוד הבא מראה כיצד לשבור קישור TextBox:
// For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Java | |
Document doc = new Document(); | |
Shape shape = new Shape(doc, ShapeType.TEXT_BOX); | |
TextBox textBox = shape.getTextBox(); | |
// Break a forward link | |
textBox.breakForwardLink(); | |
// Break a forward link by setting a null | |
textBox.setNext(null); | |
// Break a link, which leads to this textbox | |
if (textBox.getPrevious() != null) | |
textBox.getPrevious().breakForwardLink(); |