关键字:

常见问题

更多>>

最受欢迎的文章

更多>>

最新文章

更多>>

文章存档

  • 2012年06月(6)
  • 2012年07月(83)
  • 2012年08月(62)
  • 2012年09月(30)
  • 2012年10月(8)
  • 2012年11月(11)
  • 2012年12月(9)
  • 2013年01月(7)
  • 2013年02月(1)
  • 2013年03月(1)
  • 2013年04月(1)
  • 2013年05月(2)
  • 2013年06月(1)
  • 2013年07月(2)
  • 2013年08月(4)
  • 2013年09月(4)
  • 2013年10月(3)
  • 2013年11月(2)
  • 2013年12月(1)
  • 2014年01月(1)
  • 2014年03月(1)
  • 2015年06月(2)
  • 2015年10月(1)
  • 2015年11月(9)
  • 2015年12月(2)
  • 2016年02月(1)
  • 2016年04月(1)
  • 2016年05月(16)

热门Tag标签

FastScript安装 安装 VCL mvc FastReport.Net 报表 FastReport.Net v2016.2 TeeChart,图表开发 FastReport FMX 2.3 FastReport.Net v2016.1 FastReport.Net更新 FastCube VCL v2.5 FastReport VCL FastReport Online Designer教程 FastReport Online Designer组件 FastReport在线报表设计器:组件简介 FastReport在线报表设计器:界面结构简介 FastReport在线报表设计器:工作原理 FastReport Online Designer简介 FastReport Online Designer促销 FastReport Online Designer FastReport.Net授权促销 数据库查询构建 使用技巧 fastreport,报表 脚本引擎 FastScript FastScript, 脚本引擎  OLAP控件 OLAP 

使用FastReport报表时,如何根据字体实现控件分行?

作者:zhuhm    来源:本站原创    浏览:Loading...      日期:2012-09-14

使用FastReport报表时,根据字体实现控件分行,代码如下:

function HeightOfByte(var Font:TFont):Extended;
var
  con:Extended;
  num:Integer;
begin
  if Font.Size >=3 then
  begin
    num:=(Font.Size-1) div 10;
    Result:=6.0743+1.32284*(Font.Size-3)+num*0.0945;
  end
  else
  begin
    if Font.Size=2 then
    begin
      Result:=5.7969;
    end
    else
    begin
      Result:=3.3071;
    end;
  end;
end;
function WidthOfByte(var Font:TFont):Extended;
var
  con:Extended;
  num:Integer;
begin
  num:=0;
  if Font.Size >=2 then
    num:=(Font.Size-2) div 6 + 1;
  Result:=0.0378+0.65252*Font.Size+num*0.1512;
  if Font.Style <<fsBold> then
    Result:=Result+0.0756;
end;
function GetLength(var Font:TFont;Width:Extended):Integer;
var
  BW:Extended;
begin
  BW:=WidthOfByte(Font);
  Result:=0;
  while Result*BW <Width do
  begin
    Result:=Result+1;
  end;
end;
procedure DisposeString(var pString:String;pLen:Integer;WS:TWideStrings);
var
  Data,CurData:String;
  varXX:Variant;
  Len,Len_Y:Integer;
  BW:Extended;
begin
  WS.Clear();
  Data:=pString;
  varXX.bstrVal:=Data;
  Len:=Length(varXX);
  while pLen <Len do
  begin
    Len_Y:=1;
    while Len_Y <pLen do
    begin
      if Ord(Data[Len_Y]) >127 then
        Len_Y:=Len_Y+1;
      Len_Y:=Len_Y+1;
    end;
    CurData:=Copy(Data,1,Len_Y);
    WS.Add(CurData);
    Data:=Copy(Data,Len_Y+1,Len-Len_Y);
    Len:=Len-Len_Y;
  end;
  WS.Add(Data);
end;

Tag标签:FastReportVCL 

上一篇: FastReport中变量的表达方式和注意问题?

下一篇: 如何打印指定行数后换页?


下载试用 | 技术指南 | 常见问题 | 联系方式 | 法律顾问:欣力律师事务所

慧都科技旗下网站-FastReport中文网版权所有 Copyright 2012

FastReport,报表控件,FastReport报表,VCL报表,.NET报表,COM/ActiveX报表,OLAP控件,联机分析处理