各位大虾:
      你门好。   我的工作环境是繁体xp+delphi7.0+reportbuilder7.03版本,在用reportbuilder作报表时,ppdbmemo换行乱码,后来我在网上找了改ppPlainText.pas 中的procedure TppTextWrapper.WrapCharacters(const aLine: String; var aNextWord, aRemainingChars: String);代码,我改了之后。还是不行,希望各位指点一下。(以前好象在win2000下没问题)。   谢谢了。

解决方案 »

  1.   

    win2000是unicode的,目前的RB對中文支持不是很好。
    你是怎么改的?
    應該是WrapCharacters例程中的變量申明類型改一下就可以
      lsCurrentLine: WideString;
      lsNextWord: WideString;
    然后重新編譯相關dpk即可
      

  2.   

    步骤如下
    1。修改rbRCL107.dpk中的ppPlainText.pas 
    // ppPlainText.pas procedure TppTextWrapper.WrapCharacters(const aLine: String; var aNextWord, aRemainingChars: String);
    var
    lbFits: Boolean;
    liLineWidth: Integer;
    liIndex: Integer;
    lsCurrentLine: String;
    lsNextWord: String;
    beginlsNextWord := aNextWord;
    lsCurrentLine := aLine;liIndex := 1;
    lbFits := True;
    aRemainingChars := '';while lbFits and (liIndex <= Length(lsNextWord)) do
    beginliLineWidth := CalcTextWidth(lsCurrentLine lsNextWord[liIndex]);{there is room to print next word on current line}
    if (liLineWidth <= FWidthAvailable) then
    lsCurrentLine := lsCurrentLine lsNextWord[liIndex]else
    begin
    lbFits := False;if (liIndex = 1) then
    beginif (aLine <> '') then
    begin
    aNextWord := '';aRemainingChars := lsNextWord;
    endelse
    begin
    aNextWord := lsNextWord[1];aRemainingChars := Copy(lsNextWord, 2, Length(lsNextWord));
    end;endelse
    begin
    ///修改--begin
    if StrByteType(Pchar(lsNextWord),liIndex)=mbLeadByte then //如果换行的第一个字符是中文的 ////////{就}
    begin
    aNextWord := Copy(lsNextWord, 1, liIndex - 2);
    aRemainingChars := Copy(lsNextWord, liIndex-1, Length(lsNextWord));
    end else
    begin
    aNextWord := Copy(lsNextWord, 1, liIndex - 1);
    aRemainingChars := Copy(lsNextWord, liIndex, Length(lsNextWord));
    end;
    ///修改--end;
    end;end;Inc(liIndex);end;end;2、重新编译rbRCL107.bpk
    3、关闭delphi.
    4、\Program Files\Borland\Delphi7\Projects\Bpl 中复制rbRCL107.bpl 和rbRCL107.dcp到
    \WINDOWS\system32 覆盖原来的文件。
    再次打开delphi,试一试,呵呵,已经搞定了!
    ///////
    以上我是在网上看到的,我记的好象以前在win2000x下改了是成共的。现在操作系统换成xp了,我照上面改了之后,还是不行,希望大家指点一下。
      
      

  3.   

    其他不用改,把變量的string類型改為widestring
      

  4.   

    to:Avan_Lau,to:Avan_Lau, 我试过了。还是不行呀。能否流下QQ号码交流一下。
      

  5.   

    你是采用exe + bpl還是 dll或就一個exe?
    若是后者,在編譯完dpk後,除了丟到system32外,還有重新編譯一下程序...
      

  6.   

    步骤如下:我找到rbRCL77.dpk中的ppPlainText.pas ,修改完保存之后,然后编译bRCL77.dpk,然后在C:\Program Files\Borland\Delphi7\Projects\Bpl目录中找到刚刚编译完的最新的rbRCL77.bpl和rbRCL77.dcp,关闭delphi7,把这两个文件覆盖了system32目錄下的文件,然后重新的打开delphi7,编译原来的程序。在xp运行exe程序有乱码,还是不行,放到win2000下运行正常,无乱码。   不知道什么原因。因为现在用户都是使用winxp,没人用win2000,希望大家讨论一下怎么解决这个问题。
      

  7.   

    搜索rbRCL77 看是否存在舊版,檢查IDE環境lib path是否有指向這些舊的....另外,這亂碼也有可能是字符集編碼問題。可以將亂碼部分刪除,再重新輸入看看。
    若重新輸入的沒問題,那就是這個原因了。
      

  8.   

    我搜索了 rbRCL77,凡是有的地方我都用新的替换了,就是3个地方:1是system32中,还有一个就是C:\Program Files\Borland\Delphi7\RBuilder\Lib目錄下,还有的就是C:\Program Files\Borland\Delphi7\Projects\Bpl目錄下,这3个地方全是新的。  测试过后,xp下顯示的还是乱码。但Win2000下正常。
      

  9.   

     這個問題在csdn的一個網友上幫助下已經解決,就是在我上面的那段代碼中,修改ppplaintext.pas中改成
               if Bytetype(lsNextWord,liIndex - 1) in [mbLeadByte] then  //就是換上這一句話就OK了。