TableContentAlignment
Contents
[
Hide
]TableContentAlignment enumeration
Allows to specify the alignment of the content of the table to be used when exporting into Markdown format.
public enum TableContentAlignment
Values
Name | Value | Description |
---|---|---|
Auto | 0 | The alignment will be taken from the first paragraph in corresponding table column. |
Left | 1 | The content of tables will be aligned to the Left. |
Center | 2 | The content of tables will be aligned to the Center. |
Right | 3 | The content of tables will be aligned to the Right. |
Examples
Shows how to align contents in tables.
DocumentBuilder builder = new DocumentBuilder();
builder.InsertCell();
builder.ParagraphFormat.Alignment = ParagraphAlignment.Right;
builder.Write("Cell1");
builder.InsertCell();
builder.ParagraphFormat.Alignment = ParagraphAlignment.Center;
builder.Write("Cell2");
MarkdownSaveOptions saveOptions = new MarkdownSaveOptions { TableContentAlignment = tableContentAlignment };
builder.Document.Save(ArtifactsDir + "MarkdownSaveOptions.MarkdownDocumentTableContentAlignment.md", saveOptions);
Document doc = new Document(ArtifactsDir + "MarkdownSaveOptions.MarkdownDocumentTableContentAlignment.md");
Table table = doc.FirstSection.Body.Tables[0];
switch (tableContentAlignment)
{
case TableContentAlignment.Auto:
Assert.AreEqual(ParagraphAlignment.Right,
table.FirstRow.Cells[0].FirstParagraph.ParagraphFormat.Alignment);
Assert.AreEqual(ParagraphAlignment.Center,
table.FirstRow.Cells[1].FirstParagraph.ParagraphFormat.Alignment);
break;
case TableContentAlignment.Left:
Assert.AreEqual(ParagraphAlignment.Left,
table.FirstRow.Cells[0].FirstParagraph.ParagraphFormat.Alignment);
Assert.AreEqual(ParagraphAlignment.Left,
table.FirstRow.Cells[1].FirstParagraph.ParagraphFormat.Alignment);
break;
case TableContentAlignment.Center:
Assert.AreEqual(ParagraphAlignment.Center,
table.FirstRow.Cells[0].FirstParagraph.ParagraphFormat.Alignment);
Assert.AreEqual(ParagraphAlignment.Center,
table.FirstRow.Cells[1].FirstParagraph.ParagraphFormat.Alignment);
break;
case TableContentAlignment.Right:
Assert.AreEqual(ParagraphAlignment.Right,
table.FirstRow.Cells[0].FirstParagraph.ParagraphFormat.Alignment);
Assert.AreEqual(ParagraphAlignment.Right,
table.FirstRow.Cells[1].FirstParagraph.ParagraphFormat.Alignment);
break;
}
See Also
- namespace Aspose.Words.Saving
- assembly Aspose.Words