我用QR作打印,已将QRDBtext的AutoSize设为False,WordWrap也设为True了,但打印出来的内容还是不自动换行是什么原因?谢谢!(Win98+Delphi6)
(在打印报表栏里放了半天也没人回答,只好贴到这里来了)

解决方案 »

  1.   

    这是QuickRep控件的Bug。
    QuickRep是Delphi中问题最多的控件了,所以在最新的Delphi 7 中换成了另外一家公司的报表控件
      

  2.   

    这个主要是因为 QuickRep 对中文处理不好的原因,我们这边原来试了N多种方法都没有搞定!不过,英文是可以,不过要是单词的情况下。
      

  3.   

    quickreport的bug
    quickreport不认识中文,所以不支持中文的自动换行
    使用
      procedure AddWord(aWord : string);
    {$ifdef ver100}
      var
        S: string;
    {$endif}
      begin
        if aLineWidth(NewLine + aWord) > Width then
        begin
          if NewLine = '' then
          begin
    {$ifdef ver100}
            if SysLocale.FarEast then
            begin
              while true do
              begin
                if (aWord[1] in LeadBytes) and (Length(aWord) > 1) then
                  S := copy(aWord, 1, 2)
                else
                  S := copy(aWord, 1, 1);            if aLineWidth(NewLine + S) < Width then
                begin
                  NewLine := NewLine + S;
                  Delete(aWord, 1, Length(S));
                end
                else
                  Break;
              end;
            end
            else
              while aLineWidth(NewLine + copy(aWord, 1, 1)) < Width do
              begin
                NewLine := NewLine + copy(aWord, 1, 1);
                Delete(aWord, 1, 1);
              end;
    {$else}
            while aLineWidth(NewLine + copy(aWord, 1, 1)) < Width do
            begin
              NewLine := NewLine + copy(aWord, 1, 1);
              Delete(aWord, 1, 1);
            end;
    {$endif}
            aWord := '';
          end;
          FlushLine;
          if aLineWidth(aWord) > Width then
          begin
            if NewLine = '' then
            begin
              if Width = 0 then
                aWord := ''
              else
                while aLineWidth(aWord) > Width do
    {$ifdef ver100}
                  if ByteType(aWord, Length(aWord)) = mbTrailByte then
                    Delete(aWord, Length(aWord)-1, 2)
                  else
    {$endif}
                    Delete(aWord, Length(aWord), 1);
            end;
            NewLine := aWord;
            FlushLine;
            aWord := '';
          end;
          if not WordWrap then
          begin
            aWord := '';
            LineFinished := true;
          end;
        end;
        NewLine := NewLine + aWord;
      end;替换掉quickreport里面的相应过程,然后编译
      

  4.   

    不好意思,我刚看到,就Copy 一份放到这里了。
      

  5.   

    是的。我看到了。我又Copy 来了。错了,是把QrCtrls的这个过程换掉
      

  6.   

    To CityhunterID:
       说具体一点好吗?具体替换哪个过程?谢谢!
      

  7.   

    你打开 QrCtrls 这个过程,然后找到 
    procedure AddWord(aWord : string);把这个过程完全替换掉!
      

  8.   

    怎么打开 QrCtrls 这个过程,怎么找 procedure AddWord(aWord : string);
    ,怎么替换就不用说了吧!
      

  9.   

    为什么我的机器说找不到QrCtrls.pas呀?急!!
      

  10.   

    不用那么麻烦,我前几天刚碰到这个问题,下载一个report builder,用里面的memo就解决了
      

  11.   

    在哪里下的?谢谢!可否给我一份[email protected]
      

  12.   

    QRDBtext的AutoStretch 设为True
      

  13.   

    你可以用qrdbrichtext啊???为什么不用????
      

  14.   

    给QRLabel写OnPrint事件就可以了。
    procedure Tform1.QRDBText4Print(sender: TObject;
      var Value: String);
    begin
      Value:= wrap_line(Value, 15);
    end;{------------------------------------------------------}
    {
    功能:对一个Pascal字符串进行定长换行处理
    入口参数:Value -- 要转换的Pascal字符串, max_len_line -- 每行Unicode字符个数。
    返回结果:转换后的字符串。
    }
    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;
      

  15.   

    QRDBtext的AutoStretch 设为True,AutoSize设为False
    把QRDBtext的左右长度拉为所需长度上下长度可不管