Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
There are floating tables and inline tables:
Sometimes you need to position a table in a document in a certain way. To do this, you need to use the alignment tools and set the indents between the table and the surrounding text.
In this article, we will discuss what options Aspose.Words provides for positioning.
You can set the position of an inline table using the Aspose.Words API and the Alignment property. Thus, you can adjust the alignment of the table relative to the document page.
The following code example shows how to set the position of an inline table:
If the table text wrapping is set to Around, you can get the table’s horizontal and vertical alignment using the RelativeHorizontalAlignment and RelativeVerticalAlignment properties.
With other types of text wrapping, you can get inline table alignment using the Alignment property.
The following code example shows how to get the table’s alignment:
The position of a floating table is determined using the following properties:
The following code example shows how to get the position of a floating table:
Just like getting, you can set the position of a floating table using the same Aspose.Words API.
It is important to know that alignment and horizontal and vertical distance are combined properties and one can reset the other. For example, setting the RelativeHorizontalAlignment will reset the AbsoluteHorizontalDistance to its default value and vice versa. The same is true for the vertical arrangement.
The following code example shows how to set the position of a floating table:
Aspose.Words also provides an opportunity to find out the distances between tables and surrounding texts:
The following code example shows how to get the distance between a table and its surrounding text:
Q: How can I change the alignment of an inline table?
A: Use the Table.Alignment property. Set it to one of the TableAlignment enum values such as CENTER, LEFT, or RIGHT to align the table relative to the page margins.
Q: Which properties let me read the alignment of a floating table?
A: For floating tables with text wrapping set to Around, read Table.RelativeHorizontalAlignment and Table.RelativeVerticalAlignment. These return values from the RelativeHorizontalAlignment and RelativeVerticalAlignment enums.
Q: What is the correct way to position a floating table at a specific location?
A: Set the appropriate anchor (Table.HorizontalAnchor, Table.VerticalAnchor) and then specify either the absolute distances (Table.AbsoluteHorizontalDistance, Table.AbsoluteVerticalDistance) or the relative alignments. Remember that changing a relative alignment resets the corresponding absolute distance to its default.
Q: How can I obtain the distances between a table and the surrounding text?
A: Use the four distance properties: Table.DistanceTop, Table.DistanceBottom, Table.DistanceLeft, and Table.DistanceRight. Each returns the distance in points.
Q: How do I change the text wrapping mode of a table to enable floating positioning?
A: Set the Table.TextWrapping property to TextWrapping.Around. After that, you can manipulate the floating‑table properties such as anchors, distances, and alignments.
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.