Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
In Aspose.Words, the TextBox class is used to specify how text is displayed inside a shape. It exposes a public property named Parent to get the parent shape for the text box so that the customer can find the linked Shape from the associated TextBox.
The TextBox class provides IsValidLinkTarget method in order to check whether the TextBox can be linked to the target Textbox.
The following code example shows how to check if the TextBox can be linked to the target Textbox:
There are several ways to display text in a shape. The TextBox can be the Head, Middle, or Tail of a sequence.
The following code example shows how to check if TextBox is a Head, Tail, or Middle of the sequence:
Using the BreakForwardLink method you can break the link to the next TextBox.
The following code example shows how to break a link for a TextBox:
Q: How can I verify that one TextBox can be linked to another TextBox?
A: Use the TextBox::IsValidLinkTarget method. Pass the target TextBox instance to this method; it returns true if the link is allowed, otherwise false. This check prevents linking incompatible text boxes.
Q: How do I determine whether a TextBox is the head, middle, or tail of a linked sequence?
A: The TextBox class provides the properties IsHead, IsMiddle, and IsTail. Inspect these boolean properties to know the position of the current TextBox within the linked chain.
Q: What is the correct way to break an existing forward link from a TextBox?
A: Call the BreakForwardLink() method on the TextBox you want to detach. This removes the link to the next TextBox while leaving the rest of the chain intact.
Q: How can I obtain the Shape that contains a given TextBox?
A: Use the Parent property of the TextBox. It returns a pointer to the owning Shape object, allowing you to access shape‑level properties such as position, size, or fill.
Q: How do I link two TextBoxes together programmatically?
A: After confirming the link is valid with IsValidLinkTarget, assign the target TextBox to the source using SetLinkTarget. Example:
Aspose::Words::Drawing::TextBox* sourceBox = sourceShape->GetTextBox();
Aspose::Words::Drawing::TextBox* targetBox = targetShape->GetTextBox();
if (sourceBox->IsValidLinkTarget(targetBox))
{
sourceBox->SetLinkTarget(targetBox);
}
This creates a forward link from sourceBox to targetBox.
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.