Ich möchte eine Textausrichtung in einer Tabellenzelle in einer Tabelle mit OpenXML anwenden.Begründung in Text aus TableCell mit OpenXML SDK 2.0
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 Sie helfen!
Sieht gut aus, haben Sie versucht, indem Sie den Typ aus JustificationValues ändern? zu JustificationValues – Kiru
Ich tat es, aber nichts ändert sich – Aelios