Begründung im text von tableCell mit OpenXML SDK 2.0

Ich möchte einen text ausrichten in Tabellenzelle in einer Tabelle mit OpenXML.

Ich verstehe nicht, warum es nicht angewendet wird.

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;
    }
}

Thx für dir Hilfe!!!

  • Sieht gut aus, Hast du versucht, die änderung der Art von JustificationValues? zu JustificationValues
  • Ich habe es getan, aber es ändert sich nichts
InformationsquelleAutor Aelios | 2012-08-02
Schreibe einen Kommentar