Werk Met Gekoppelde TextBoxes
In Aspose.Words word die TextBox klas gebruik om te spesifiseer hoe’n teks binne’n vorm vertoon word. Dit bied’n openbare eiendom met die naam As Ouer om die ouer vorm vir die teks boks te kry om die kliënt in staat stel om gekoppelde Shape van gekoppelde TextBox te vind.
Skep’n Skakel
Die TextBox klas verskaf die IsValidLinkTarget metode om te kyk of die TextBox gekoppel kan word aan die teiken Textbox.
Die volgende kode voorbeeld toon hoe om te kyk of die TextBox
kan gekoppel word aan die teiken Teksboks:
// 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); |
Kontroleer TextBox Volgorde
Daar is verskeie maniere om teks in’n vorm te vertoon. Die TextBox kan die Kop, Middel of Stert van’n reeks wees.
Die volgende kode voorbeeld toon hoe om te kyk of TextBox is’n Kop, Stert, of Middel van die reeks:
// 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."); | |
} |
Breek’n Skakel
Met behulp van die BreakForwardLink metode kan jy die skakel na die volgende TextBox breek.
Die volgende kode voorbeeld toon hoe om’n skakel vir’n TextBoxbreek:
// 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(); |