首页 > 解决方案 > ActiveReports 13 垂直文本间距

问题描述

我正在尝试在 ActiveReports 13 中垂直对齐文本。我正在用代码创建此报告。我要匹配的示例是这样的:

在此处输入图像描述

然而,经过我的努力,我的结果最终看起来像这样:

在此处输入图像描述

即使数据源中的文本是正确的,间距似乎在奇数点中断。我正在使用的代码是:

for (int i = 0; i < dataTable.Columns.Count; i++)
{
    ctl = new GrapeCity.ActiveReports.SectionReportModel.TextBox();
    ctl.Name = columnName;
    ctl.Text = dt.Columns[i].ColumnName;
    ctl.Location = new PointF((0.3f * i) + 1.7f, 0.4f);
    ctl.Size = new SizeF(0.3f, 1.0f);
 
    ctl.VerticalText = true;
    ctl.VerticalAlignment = GrapeCity.ActiveReports.Drawing.VerticalTextAlignment.Middle;
}

增加宽度没有帮助。如果我缩小 Size 值并调整 CharacterSpacings,文本间距问题会得到改善,但背景会变窄并且文本对齐方式会发生变化 - 字符旋转 90 度:

在此处输入图像描述

有什么建议么?

标签: c#activereports

解决方案


我发现解决这个问题的方法是将 TextBox 转换为 Label,然后将 Angle 属性更改为 2700。将 Alignment 设置为“Right”也可以按照我想要的方式对齐文本:

ctl = new GrapeCity.ActiveReports.SectionReportModel.Label();
ctl.Angle = 2700;
ctl.Alignment = GrapeCity.ActiveReports.Drawing.TextAlignment.Right;

推荐阅读