用FastReport制作报表,有的字段内容大多,显示不完成,希望缩小字体显示
网上查了很久,几种方案都试过,没有解决,最终在即将放弃的时候,找到解决方案
闲话少说,上代码:
private void Text4_AfterData(object sender, EventArgs e)
{
if(Text4.Text.Trim().Length >35)
{
Text4.Font= new Font("宋体",7);
}
}
之前网上有一段
private void Text1_BeforePrint(object sender, EventArgs e)
{
if(Text1.Text.Length>7)
{
Text1.Font=new Font("宋体",9);
}
else if(Text1.Text.Length>=5 && Text1.Text.Length<7)
{
Text1.Font=new Font("宋体",12);
}
}
这个事件,所有的都会变小。

本文介绍了一种在使用FastReport制作报表时,针对字段内容过多导致显示不全的问题,通过自定义事件实现字体大小的自动调整,确保所有内容都能完整显示的方法。
5207





