Выравнивание текста из tableCell с OpenXML SDK 2.0

Я хочу применить выравнивание текста в ячейке таблицы в таблице с OpenXML.

Я не понимаю, почему это не применяется.

Table table = new Table();
TableRow tableHeader = new TableRow();
table.AppendChild<TableRow>(tableHeader);
TableCell tableCell = new TableCell();
tableHeader.AppendChild<TableCell>(tableCell);
Paragraph paragraph = new Paragraph(new Run(new Text("test")));
ParagraphProperties paragraphProperties = new ParagraphProperties();
JustificationValues? justification = GetJustificationFromString("centre");
if (justification != null)
{
     paragraphProperties.AppendChild<Justification>(new Justification() { Val = justification });
}
paragraph.AppendChild<ParagraphProperties>(paragraphProperties);
tableCell.AppendChild<Paragraph>(paragraph);


public static JustificationValues? GetJustificationFromString(string alignment)
{
    switch(alignment)
    {
        case "centre" : return JustificationValues.Center;
        case "droite" : return JustificationValues.Right;
        case "gauche" : return JustificationValues.Left;
        default: return null;
    }
}

Спасибо за помощь!

6
задан Aelios 2 August 2012 в 15:06
поделиться