TextBox 작업
Aspose.Words에서 TextBox 클래스는 도형 내부에 텍스트가 표시되는 방식을 지정하는 데 사용됩니다. 고객이 연결된 TextBox에서 연결된 Shape를 찾을 수 있도록 텍스트 상자의 상위 모양을 가져오기 위해 Parent이라는 공용 속성을 노출합니다.
링크 만들기
TextBox 클래스는 TextBox가 대상 Textbox에 연결될 수 있는지 확인하기 위해 IsValidLinkTarget 메서드를 제공합니다.
다음 코드 예제에서는 TextBox
를 대상 텍스트 상자에 연결할 수 있는지 확인하는 방법을 보여줍니다
// For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-.NET | |
Document doc = new Document(); | |
Shape shape1 = new Shape(doc, ShapeType.TextBox); | |
Shape shape2 = new Shape(doc, ShapeType.TextBox); | |
TextBox textBox1 = shape1.TextBox; | |
TextBox textBox2 = shape2.TextBox; | |
if (textBox1.IsValidLinkTarget(textBox2)) | |
textBox1.Next = textBox2; |
TextBox 시퀀스 확인
도형에 텍스트를 표시하는 방법에는 여러 가지가 있습니다. TextBox는 시퀀스의 헤드, 중간 또는 테일이 될 수 있습니다.
다음 코드 예제는 TextBox가 시퀀스의 머리, 꼬리 또는 중간인지 확인하는 방법을 보여줍니다
// For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-.NET | |
Document doc = new Document(); | |
Shape shape = new Shape(doc, ShapeType.TextBox); | |
TextBox textBox = shape.TextBox; | |
if ((textBox.Next != null) && (textBox.Previous == null)) | |
{ | |
Console.WriteLine("The head of the sequence"); | |
} | |
if ((textBox.Next != null) && (textBox.Previous != null)) | |
{ | |
Console.WriteLine("The Middle of the sequence."); | |
} | |
if ((textBox.Next == null) && (textBox.Previous != null)) | |
{ | |
Console.WriteLine("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-.NET | |
Document doc = new Document(); | |
Shape shape = new Shape(doc, ShapeType.TextBox); | |
TextBox textBox = shape.TextBox; | |
// Break a forward link | |
textBox.BreakForwardLink(); | |
// Break a forward link by setting a null | |
textBox.Next = null; | |
// Break a link, which leads to this textbox | |
if (textBox.Previous != null) | |
textBox.Previous.BreakForwardLink(); |