QRDBRichText如何显示文本字段?QRDBText能不能自动换行,如何换行?

解决方案 »

  1.   

    这样对吗?QRRichText1.Lines.clear; 
    QRRichText1.Lines.Add('hello world');
      

  2.   

    QRDBText只有在有空格的情况下才能自动换行,这对英文没问题,
    但中文的数据大多中间没有空格,不能自动换行如果非要用程序解决,1、插入空格或#13#10;2、修改源码(别问我,我不会,呵呵)。
    如果不是,那么下载一个3.06版本的QR,可以实现中文的自动换行。源码如下:
    DetailBand1.Frame.DrawLeft:= true;
    DetailBand1.Frame.DrawRight:= true;
    QRDBText2.AutoSize := True;
    QRDBText2.AutoStretch := True;procedure TfmRep.QRDBText2Print(sender: TObject; var Value: String);
    begin
      Value := wrap_line(Value,10);
      //10表示一行打印字符数.
    end;function wrap_line(Value: String; max_len_line: integer ): String;
    var
      ws: WideString;
      s: string;
    begin
      ws:= Value;
      s:= '';
      while length(ws) > MAX_LEN_LINE do begin
        s:= s + Copy(ws, 1, MAX_LEN_LINE) + #13;
        delete(ws, 1, MAX_LEN_LINE);
      end;
      Result:= s + ws;
    end;