正在 Devexpress 中设计简单的报告。我在xtrareport中连续添加了三个标签。第一个标签和最后一个标签在设计器屏幕中设置,但中间标签数据来自数据库,它可能是(大或小)单词或句子。如果数据来自数据库大意味着第三个标签与该数据重叠。怎么解决这个问题??提前致谢。
最佳答案
<强>0。三个标签。
在报表设计器中,尽可能设置第二个标签的宽度:
将 CanShrink
、CanGrow
、Multiline
和 WordWrap
设置为 true
:
xrLabel2.CanShrink = true;
xrLabel2.CanGrow = true;
xrLabel2.Multiline = true;
xrLabel2.WordWrap = true;
结果你会得到这样的结果:
<强>1。具有特殊格式的一个标签。
您可以使用一个带有格式字符串的标签。使用 {0}
作为数据源值的占位符:
xrLabel1.DataBindings.Add(new XRBinding("Text", null, "Value", "Here is the text: «{0}». Here is the end."));
您还可以将 CanShrink
、CanGrow
、Multiline
和 WordWrap
设置为 true
.
结果将是这样的:
<强>2。一个标签的文本中带有 [括号]。
您可以将带有 [括号] 的数据字段名称插入到控件的文本中。例如:
xrLabel1.Text = "Here is the text: «[Value]». Here is the end."
结果如下:
关于devexpress - 如何处理 Reports Devexpress 中标签的自动宽度属性?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30452856/