Bağlı Metin Kutularıyla Çalışmak
Aspose.Words’te, şekil içinde görüntülenen bir metin belirtmek için “TextBox” sınıfı kullanılır. Bu, müşterinin birbirine bağlı Shape ile bağlı TextBox bulmasına izin vermek için metin kutusunun üst şekilini almak için bir ortak özellik olarak Parent ismine sahip bir sağlama sağlar.
Bir Bağlantı Oluştur
The TextBox sınıfı, hedef Textbox‘in TextBox‘a bağlanıp bağlanamayacağını kontrol etmek için IsValidLinkTarget yöntemini sağlar.
Aşağıdaki kod örneği, TextBox
‘ın hedef metin kutusuna bağlanıp bağlanamayacağını nasıl kontrol edileceğini göstermektedir":
// 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); |
Metin Kutusu Sekansını Kontrol Et
Bir şekle metin göstermek için birkaç yol var. The TextBox bir sıralamanın Başlık, Orta veya Kuyruk olabilir.
Aşağıdaki kod örneği, TextBox‘in bir başlık, kuyruk veya dizinin ortasında olup olmadığını nasıl kontrol edileceğini gösterir":
// 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."); | |
} |
Bağlantıyı kır
Using the BreakForwardLink yöntemi, bağlantıyı bir sonraki TextBox ‘u kesebilirsin.
Aşağıdaki kod örneği, bir bağlantıyı nasıl kıracağınızı gösterir: 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(); |