我在TextFrame中使用Paragraph来获取向上显示的文本方向,这几乎是我想要的方式,我得到的最后一个问题是文本似乎是左对齐的,我试过设置段落对齐到中心这没有任何影响,也无法看到使用TextFrame执行此操作的选项 . 输出的文字每次都不一样 .
这就是我现在拥有的
这就是我想要实现的目标
以下是我用于使用MigraDoc实现此目的的代码
for (int i = 0; i < section2Items.Length; i++)
{
TextFrame colXTextFrame = bothSection2ItemHeadersRow.Cells[i + 1].AddTextFrame();
colXTextFrame.Orientation = TextOrientation.Upward;
colXTextFrame.Height = new Unit(140);
Paragraph colXParagraph = new Paragraph();
colXParagraph.Format.Alignment = ParagraphAlignment.Center;
colXParagraph.AddText(section2Items[i].Section2ItemTitle);
colXTextFrame.Add(colXParagraph);
bothSection2ItemHeadersRow.Cells[i + 1].Borders.Bottom = new Border() { Color = new MigraDoc.DocumentObjectModel.Color(255, 255, 255), Width = new MigraDoc.DocumentObjectModel.Unit(0), Style = MigraDoc.DocumentObjectModel.BorderStyle.None };
}
1 回答
这是一个应该工作的代码示例 .
您可以使用
TextFrame
的MarginLeft
属性将其移动到列的中间 .这会产生以下输出: