연결된TextBoxes작업
Aspose.Words에서TextBox클래스는 도형 안에 텍스트가 표시되는 방법을 지정하는 데 사용됩니다. 고객이 연결된TextBox에서 연결된Shape을 찾을 수 있도록 텍스트 상자의 부모 모양을 가져오기 위해 부모라는 공용 속성을 제공합니다.
링크 만들기
TextBox클래스는TextBox이 대상Textbox에 연결될 수 있는지 확인하기 위해IsValidLinkTarget메소드를 제공합니다.
다음 코드 예제에서는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); |
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 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(); |