关于ReportBuild6.03中文换行出现乱码问题的解决?(100分)

  • 主题发起人 主题发起人 海风
  • 开始时间 开始时间

海风

Unregistered / Unconfirmed
GUEST, unregistred user!
请问谁能对ReportBuild6.03中文换行出现乱码问题的进行解决?
问题是在有奇数个半角字符时会出现乱码,请不要说把半角换成全角,
我想在源码上解决reportbuild的这个问题,但不知道是哪个函数进行
处理的,希望遇此问题的朋友提出好的方案
 
改源碼,換成widestring
 
to goddy:
请问在哪个单元什么地方修改,谢谢
 
看来reportbuild5.5以后的单元全改了,现在分析了一下,可能在getnextword和
TppPlainText.WordWrap中找问题的解决方式了,有一点不明白就是哪个属性来判断
每行的长度,大家可以看看这个函数提提参考意见:
class procedure TppPlainText.WordWrap(const aText: String;
aRect: TppRect;
aTextAlignment: TppTextAlignment;
aAutoSize: Boolean;
aFont: TFont;
aCharWrap: Boolean;
aLeading: Integer;
aTabStops: TStrings;
aPrinter: TObject;
var aCharPos: Integer;
aWrappedText: TStrings);
var
lTextWrapper: TppTextWrapper;
begin

lTextWrapper := TppTextWrapper.Create;
lTextWrapper.AreaAvailable := aRect;
lTextWrapper.Alignment := aTextAlignment;
lTextWrapper.AutoSize := aAutoSize;
lTextWrapper.CharWrap := aCharWrap;
lTextWrapper.Font := aFont;
lTextWrapper.Leading := aLeading;
lTextWrapper.Printer := TppPrinter(aPrinter);
lTextWrapper.Tabs := aTabStops;
lTextWrapper.Text := aText;
try
{set the current character position}
lTextWrapper.CharPos := aCharPos;
{wrap the text}
lTextWrapper.Wrap;
{get the new character position}
aCharPos := lTextWrapper.CharPos;
{get the wrapped text}
aWrappedText.Assign(lTextWrapper.WrappedText);
finally
lTextWrapper.Free;
end;

end;

还有lTextWrapper.Wrap;其实就是调用下面的函数
function TppPlainTextParser.GetNextWord: String;
var
lbEndOfWord: Boolean;
lCharacter: Char;
lsWord: String;
begin

lsWord := '';
lbEndOfWord := False;
while not(lbEndOfWord) and not(FAllWordsParsed)do
begin
{move to next position in the text}
Inc(FCharPos);
{reached end of the text}
if (FCharPos > FTextLength) then
FAllWordsParsed := True
else
begin

lCharacter := FText[FCharPos];
if (lCharacter = TppTextMarkups.Null) then
FAllWordsParsed := True
else
if (lCharacter = TppTextMarkups.Space) then
begin
lbEndOfWord := True;
if (lsWord = '') then
lsWord := TppTextMarkups.Space
else
Dec(FCharPos);
end
else
if (lCharacter = TppTextMarkups.CR) then
begin
lbEndOfWord := True;
if (lsWord <> '') then
Dec(FCharPos)
else
begin

if ((FCharPos + 1) <= FTextLength) and (FText[FCharPos + 1] = TppTextMarkups.LF) then
Inc(FCharPos);
{skip over the LF char since it was found immediately following CR}
if (FCharPos <= FTextLength) then
lsWord := TppTextMarkups.CRLF;
end;

end
else
if (lCharacter = TppTextMarkups.LF) then
begin
lbEndOfWord := True;
if (lsWord <> '') then
Dec(FCharPos)
else
if (FCharPos <= FTextLength) then
lsWord := TppTextMarkups.CRLF;
end
else
if (lCharacter = TppTextMarkups.Tab) then
begin
lbEndOfWord := True;
if (lsWord = '') then
lsWord := TppTextMarkups.Tab
else
Dec(FCharPos);
end
else
if ((FCharPos + 1) <= FTextLength) and (lCharacter + FText[FCharPos + 1] = TppTextMarkups.EOP) then
begin
lbEndOfWord := True;
if (lsWord <> '') then
Dec(FCharPos)
else
begin
Inc(FCharPos);
lsWord := TppTextMarkups.CRLF;
end;

end
else
lsWord := lsWord + lCharacter;
end;

end;

Result := lsWord;
end;
这里的判断换行方式实在让人费解,有人知道吗
 
算了吧请网管收回我的分,
好象没人对这个问题有兴趣
经过两天分析工作
还是自己得到解决办法
分是怎么收呢?
 
后退
顶部