I want to change the fontstyle of a textframe in a rect. I have no Problem to change the font properties like bold or italic. Here is the code I have written:
private void CreateLegend(Slide slide, List<MyColumn> columnData, int leftOffset, int top, int height)
{
int left = leftOffset;
for (int i = 0; i < columnData.Count; i++)
{
MyColumn tmpColumn = columnData;
Rectangle rect = slide.Shapes.AddRectangle(left, top, (int)tmpColumn.Width, height);
rect.LineFormat.ShowLines = true;
rect.AddTextFrame(tmpColumn.name);
// Schrift setzen
// I want to set the fontstyle here, but how?
rect.TextFrame.Paragraphs[0].Portions[0].FontBold = true;
rect.TextFrame.Paragraphs[0].Portions[0].FontItalic = tmpColumn.font.Italic;
rect.TextFrame.Paragraphs[0].Portions[0].FontHeight = tmpColumn.font.Size;
rect.TextFrame.Paragraphs[0].Portions[0].FontColor = tmpColumn.font.Color;
// Hintergrundfarbe setzen
rect.FillFormat.Type = FillType.Solid;
rect.FillFormat.ForeColor = tmpColumn.backcolor;
// Damit die Spalten nebeneinander sitzen
left += (int)tmpColumn.Width;
}
}
Sven