TableContentAlignment

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

FieldDescription
AUTOThe alignment will be taken from the first paragraph in corresponding table column.
CENTERThe content of tables will be aligned to the Center.
LEFTThe content of tables will be aligned to the Left.
RIGHTThe content of tables will be aligned to the Right.
length

Methods

MethodDescription
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.

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:

ParameterTypeDescription
tableContentAlignmentNamejava.lang.String

Returns: int

getName(int tableContentAlignment)

public static String getName(int tableContentAlignment)

Parameters:

ParameterTypeDescription
tableContentAlignmentint

Returns: java.lang.String

getValues()

public static int[] getValues()

Returns: int[]

toString(int tableContentAlignment)

public static String toString(int tableContentAlignment)

Parameters:

ParameterTypeDescription
tableContentAlignmentint

Returns: java.lang.String