TableContentAlignment
Contents
[
Hide
]Inheritance: java.lang.Object
public class TableContentAlignment
Allows to specify the alignment of the content of the table to be used when exporting into Markdown format.
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;
}
Fields
Field | Description |
---|---|
AUTO | The alignment will be taken from the first paragraph in corresponding table column. |
CENTER | The content of tables will be aligned to the Center. |
LEFT | The content of tables will be aligned to the Left. |
RIGHT | The content of tables will be aligned to the Right. |
length |
Methods
Method | Description |
---|---|
fromName(String tableContentAlignmentName) | |
getName(int tableContentAlignment) | |
getValues() | |
toString(int tableContentAlignment) |
AUTO
public static int AUTO
The alignment will be taken from the first paragraph in corresponding table column.
CENTER
public static int CENTER
The content of tables will be aligned to the Center.
LEFT
public static int LEFT
The content of tables will be aligned to the Left.
RIGHT
public static int RIGHT
The content of tables will be aligned to the Right.
length
public static int length
fromName(String tableContentAlignmentName)
public static int fromName(String tableContentAlignmentName)
Parameters:
Parameter | Type | Description |
---|---|---|
tableContentAlignmentName | java.lang.String |
Returns: int
getName(int tableContentAlignment)
public static String getName(int tableContentAlignment)
Parameters:
Parameter | Type | Description |
---|---|---|
tableContentAlignment | int |
Returns: java.lang.String
getValues()
public static int[] getValues()
Returns: int[]
toString(int tableContentAlignment)
public static String toString(int tableContentAlignment)
Parameters:
Parameter | Type | Description |
---|---|---|
tableContentAlignment | int |
Returns: java.lang.String