java.lang.Object
com.aspose.words.TableContentAlignment
public class TableContentAlignment
- extends java.lang.Object
Utility class containing constants.
Allows to specify the alignment of the content of the table to be used when exporting into Markdown format.
Example:
Shows how to align contents in tables.
DocumentBuilder builder = new DocumentBuilder();
builder.insertCell();
builder.getParagraphFormat().setAlignment(ParagraphAlignment.RIGHT);
builder.write("Cell1");
builder.insertCell();
builder.getParagraphFormat().setAlignment(ParagraphAlignment.CENTER);
builder.write("Cell2");
MarkdownSaveOptions saveOptions = new MarkdownSaveOptions(); { saveOptions.setTableContentAlignment(tableContentAlignment); }
builder.getDocument().save(getArtifactsDir() + "MarkdownSaveOptions.MarkdownDocumentTableContentAlignment.md", saveOptions);
Document doc = new Document(getArtifactsDir() + "MarkdownSaveOptions.MarkdownDocumentTableContentAlignment.md");
Table table = doc.getFirstSection().getBody().getTables().get(0);
switch (tableContentAlignment)
{
case TableContentAlignment.AUTO:
Assert.assertEquals(ParagraphAlignment.RIGHT,
table.getFirstRow().getCells().get(0).getFirstParagraph().getParagraphFormat().getAlignment());
Assert.assertEquals(ParagraphAlignment.CENTER,
table.getFirstRow().getCells().get(1).getFirstParagraph().getParagraphFormat().getAlignment());
break;
case TableContentAlignment.LEFT:
Assert.assertEquals(ParagraphAlignment.LEFT,
table.getFirstRow().getCells().get(0).getFirstParagraph().getParagraphFormat().getAlignment());
Assert.assertEquals(ParagraphAlignment.LEFT,
table.getFirstRow().getCells().get(1).getFirstParagraph().getParagraphFormat().getAlignment());
break;
case TableContentAlignment.CENTER:
Assert.assertEquals(ParagraphAlignment.CENTER,
table.getFirstRow().getCells().get(0).getFirstParagraph().getParagraphFormat().getAlignment());
Assert.assertEquals(ParagraphAlignment.CENTER,
table.getFirstRow().getCells().get(1).getFirstParagraph().getParagraphFormat().getAlignment());
break;
case TableContentAlignment.RIGHT:
Assert.assertEquals(ParagraphAlignment.RIGHT,
table.getFirstRow().getCells().get(0).getFirstParagraph().getParagraphFormat().getAlignment());
Assert.assertEquals(ParagraphAlignment.RIGHT,
table.getFirstRow().getCells().get(1).getFirstParagraph().getParagraphFormat().getAlignment());
break;
}
|
Field Summary |
static final int | AUTO = 0 | |
|
The alignment will be taken from the first paragraph in corresponding table column.
|
static final int | LEFT = 1 | |
|
The content of tables will be aligned to the Left.
|
static final int | CENTER = 2 | |
|
The content of tables will be aligned to the Center.
|
static final int | RIGHT = 3 | |
|
The content of tables will be aligned to the Right.
|
AUTO = 0 | |
public static final int AUTO |
-
The alignment will be taken from the first paragraph in corresponding table column.
LEFT = 1 | |
public static final int LEFT |
-
The content of tables will be aligned to the Left.
CENTER = 2 | |
public static final int CENTER |
-
The content of tables will be aligned to the Center.
RIGHT = 3 | |
public static final int RIGHT |
-
The content of tables will be aligned to the Right.
See Also:
Aspose.Words Documentation - the home page for the Aspose.Words Product Documentation.
Aspose.Words Support Forum - our preferred method of support.