怎样能够让一条TQRDBText在20宽度内自动换行?地址之类的数据实在是太长了:(~

解决方案 »

  1.   

    用 tqrmemo, 但还要自己处理换行的,一般,我先放到一个 memo,再转给tqrmemo
      

  2.   

    没有dataset属性,那很麻烦啊
      

  3.   

    wordwrap:=true;autosize:=false;autostrch:=false
      

  4.   

    用qrrichtext代替。
    办法一:
         QRDBrichText只能显示备注字段,如果你可以将这个字段改为备注字段,在sql server中可以是Text类型。方法二:
         在qrrichtext所在的band的beforeprint事件里写入如下代码
    qrrichtext.lines.text:=table.fieldbyname('field').asstring;
    将qrrichtext的autostretch设为true
    就可以了
    值得注意的是:预览的时候看不到,只有在程序运行的时候才可以看到!
      

  5.   

    用QRDBTEXT也可以实现的。
    autostretch := true;
    autosize := false;
    wordwrap := true;
    然后在要折行的地方加上空格或者回车即可(在ONPRINT事件中操作);以下是获取中文折行字符串的函数
    function GetHz0(s:string):string;
    var hz:string;i:integer;
    begin
      hz:='';
      for i:=1 to length(s) do
          begin
            if ByteType(s,i) <> mbLeadByte then    //单字节\//双字节的第二个字节
               begin
                   if trim(hz) = '' then
                      begin
                          hz := s[i]+ #13#10;
                      end
                   else
                      begin
                          if i = Length(s) then
                             begin
                                 hz := hz  + s[i];
                             end
                          else
                             begin
                                 hz := hz  + s[i]+ #13#10;  //  ' ';//
                             end;
                      end;
               end
            else      //双字节的第一个字节
               begin
                   if trim(hz) = '' then
                      begin
                          hz := s[i];
                      end
                   else
                      begin
                          hz := hz + s[i];
                      end;
               end
          end;
        GetHz0:=hz;
    end;