public class TableContentAlignment
extends java.lang.Object
Examples:
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;
}
| Modifier and Type | Field and Description |
|---|---|
static int |
AUTO
The alignment will be taken from the first paragraph in corresponding table column.
|
static int |
CENTER
The content of tables will be aligned to the Center.
|
static int |
LEFT
The content of tables will be aligned to the Left.
|
static int |
length |
static int |
RIGHT
The content of tables will be aligned to the Right.
|
| Modifier and Type | Method and Description |
|---|---|
static int |
fromName(java.lang.String tableContentAlignmentName) |
static java.lang.String |
getName(int tableContentAlignment) |
static int[] |
getValues() |
static java.lang.String |
toString(int tableContentAlignment) |
public static int AUTO
public static int LEFT
public static int CENTER
public static int RIGHT
public static int length