在rave中文字換行需要引用memo可其對中文的支持簡直太差,網上也有解決之意見,
不過小生確沒有編譯通過!望給予意見! 以下是網上解決之代碼和編譯過程,幫忙分析!把RpMemo.pas文件中的TMemoBuf.GetLine函數進行如下的脩改。然后重新編譯RvCore.dpk包。把編譯獲得的RvCore50.bpl拷貝到Rave.exe對應的目錄即可! function TMemoBuf.GetLine( Width: longint;
var Eol: boolean): string;
var
TestWidth: longint;
SavePos: longint;
NewWord: string;
S1: string;
S2: string;
StartPos: longint;
FormatState: TFormatState;
StartState: string;
AdjWidth: longint;
FirstLine: boolean; //SCYANGYU ************** Start **************
Function CurLineEndHalfCHS(Const CurLineStr:String):Boolean;
Var
bIsDBCS:Boolean;
jLength,jFor:Integer;
Begin
bIsDBCS := False;
jLength:=Length(CurLineStr);
for jFor := 1 to jLength do
begin
if bIsDBCS then
bIsDBCS := False
else
Begin
if Windows.IsDBCSLeadByte(byte(CurLineStr[jFor])) then
bIsDBCS := True;
End;
end; //end of for
Result:=bIsDBCS;
End;
//SCYANGYU ************** End ************** begin { GetLine }
{ Get a line of text that will fit within PrintStart to PrintEnd }
EOL := false;
NewLine := true;
StartPos := -1;
S1 := '';
S2 := '';
StartState := '';
Result := '';
FirstLine := NewParagraph;
AdjWidth := Width; repeat
SavePos := FPos; { Save off current position}
NewWord := GetWord; { Get next word } if StartPos < 0 then
begin { Initial run through }
StartPos := NonSpacePos;
if HasRPTF then
begin { Get state of line start }
FormatState := GetStateAtPos(SavePos);
StartState := StateToRPTF(FormatState);
if FirstLine then
begin
LeftIndent := FormatState.Para.FirstIndent + FormatState.Para.LeftIndent;
end
else
begin
LeftIndent := FormatState.Para.LeftIndent;
end; { else }
RightIndent := FormatState.Para.RightIndent;
AdjWidth := Width - Round((LeftIndent + RightIndent) * BaseReport.XDPI);
if AdjWidth < BaseReport.XDPI then
begin { Don't allow width less than 1" }
AdjWidth := BaseReport.XDPI;
end; { if }
end; { if }
end; { if } if (NewWord = #13) or (NewWord = '') then
begin { Finish off line }
EOL := true;
if Result = '' then
begin
Result := StartState;
end; { if }
Break;
end
else
begin { Test width with new word }
S2 := S2 + NewWord;
S1 := StartState + FillRPTF(S2,StartPos); if System.Pos(RPTFPrefix,S1) = 0 then
begin
TestWidth := SimpleTextWidth(BaseReport,S1,0);
end
else
begin
TestWidth := RPTFTextWidth(BaseReport,S1);
end; { else } if TestWidth <= AdjWidth then
begin { Add new word }
Result := S1;
end
else
begin
{ Reset position to before this word}
FPos := SavePos;
end; { else } if TestWidth >= AdjWidth then
begin
if UnformatLen(Result) = 0 then
begin { First word was too long, cut it down }
repeat { Add on characters until enough width }
S1 := Result;
while FBuffer^[FPos] = RPTFPrefix do
begin { Add on RPTF stuff }
repeat
S1 := S1 + FBuffer^[FPos];
Inc(FPos);
until FBuffer^[FPos] = RPTFSuffix;
S1 := S1 + FBuffer^[FPos];
Inc(FPos);
end; { while }
S1 := S1 + FBuffer^[FPos]; if System.Pos(RPTFPrefix,S1) = 0 then
begin
TestWidth := SimpleTextWidth(BaseReport,S1,0);
end
else
begin
TestWidth := RPTFTextWidth(BaseReport,S1);
end; { else }
if TestWidth <= AdjWidth then
begin
if S1 = ' ' then
begin
Result := '';
end
else
begin
Result := S1;
end; { else }
Inc(FPos);
end; { if }
until (TestWidth >= AdjWidth) or (FPos >= FSize);
end; { if }
Break;
end; { if }
end; { else }
until false; //SCYANGYU ************** Start **************
If CurLineEndHalfCHS(Result) Then
Begin
System.Delete(Result,Length(Result),1);
Dec(FPos);
End;
//SCYANGYU ************** End ************** end; { GetLine } RAVE各个包的编译的先后顺序为: RvCore.dpk
RvStandard.dpk
RvBarcode.dpk
RvGraphics.dpk
RvReport.dpk
Rave50VCL.dpk
RvEngine.dpk
RvDesign.dpk
dclRave.dpk 在線等,解決後送高分!
不過小生確沒有編譯通過!望給予意見! 以下是網上解決之代碼和編譯過程,幫忙分析!把RpMemo.pas文件中的TMemoBuf.GetLine函數進行如下的脩改。然后重新編譯RvCore.dpk包。把編譯獲得的RvCore50.bpl拷貝到Rave.exe對應的目錄即可! function TMemoBuf.GetLine( Width: longint;
var Eol: boolean): string;
var
TestWidth: longint;
SavePos: longint;
NewWord: string;
S1: string;
S2: string;
StartPos: longint;
FormatState: TFormatState;
StartState: string;
AdjWidth: longint;
FirstLine: boolean; //SCYANGYU ************** Start **************
Function CurLineEndHalfCHS(Const CurLineStr:String):Boolean;
Var
bIsDBCS:Boolean;
jLength,jFor:Integer;
Begin
bIsDBCS := False;
jLength:=Length(CurLineStr);
for jFor := 1 to jLength do
begin
if bIsDBCS then
bIsDBCS := False
else
Begin
if Windows.IsDBCSLeadByte(byte(CurLineStr[jFor])) then
bIsDBCS := True;
End;
end; //end of for
Result:=bIsDBCS;
End;
//SCYANGYU ************** End ************** begin { GetLine }
{ Get a line of text that will fit within PrintStart to PrintEnd }
EOL := false;
NewLine := true;
StartPos := -1;
S1 := '';
S2 := '';
StartState := '';
Result := '';
FirstLine := NewParagraph;
AdjWidth := Width; repeat
SavePos := FPos; { Save off current position}
NewWord := GetWord; { Get next word } if StartPos < 0 then
begin { Initial run through }
StartPos := NonSpacePos;
if HasRPTF then
begin { Get state of line start }
FormatState := GetStateAtPos(SavePos);
StartState := StateToRPTF(FormatState);
if FirstLine then
begin
LeftIndent := FormatState.Para.FirstIndent + FormatState.Para.LeftIndent;
end
else
begin
LeftIndent := FormatState.Para.LeftIndent;
end; { else }
RightIndent := FormatState.Para.RightIndent;
AdjWidth := Width - Round((LeftIndent + RightIndent) * BaseReport.XDPI);
if AdjWidth < BaseReport.XDPI then
begin { Don't allow width less than 1" }
AdjWidth := BaseReport.XDPI;
end; { if }
end; { if }
end; { if } if (NewWord = #13) or (NewWord = '') then
begin { Finish off line }
EOL := true;
if Result = '' then
begin
Result := StartState;
end; { if }
Break;
end
else
begin { Test width with new word }
S2 := S2 + NewWord;
S1 := StartState + FillRPTF(S2,StartPos); if System.Pos(RPTFPrefix,S1) = 0 then
begin
TestWidth := SimpleTextWidth(BaseReport,S1,0);
end
else
begin
TestWidth := RPTFTextWidth(BaseReport,S1);
end; { else } if TestWidth <= AdjWidth then
begin { Add new word }
Result := S1;
end
else
begin
{ Reset position to before this word}
FPos := SavePos;
end; { else } if TestWidth >= AdjWidth then
begin
if UnformatLen(Result) = 0 then
begin { First word was too long, cut it down }
repeat { Add on characters until enough width }
S1 := Result;
while FBuffer^[FPos] = RPTFPrefix do
begin { Add on RPTF stuff }
repeat
S1 := S1 + FBuffer^[FPos];
Inc(FPos);
until FBuffer^[FPos] = RPTFSuffix;
S1 := S1 + FBuffer^[FPos];
Inc(FPos);
end; { while }
S1 := S1 + FBuffer^[FPos]; if System.Pos(RPTFPrefix,S1) = 0 then
begin
TestWidth := SimpleTextWidth(BaseReport,S1,0);
end
else
begin
TestWidth := RPTFTextWidth(BaseReport,S1);
end; { else }
if TestWidth <= AdjWidth then
begin
if S1 = ' ' then
begin
Result := '';
end
else
begin
Result := S1;
end; { else }
Inc(FPos);
end; { if }
until (TestWidth >= AdjWidth) or (FPos >= FSize);
end; { if }
Break;
end; { if }
end; { else }
until false; //SCYANGYU ************** Start **************
If CurLineEndHalfCHS(Result) Then
Begin
System.Delete(Result,Length(Result),1);
Dec(FPos);
End;
//SCYANGYU ************** End ************** end; { GetLine } RAVE各个包的编译的先后顺序为: RvCore.dpk
RvStandard.dpk
RvBarcode.dpk
RvGraphics.dpk
RvReport.dpk
Rave50VCL.dpk
RvEngine.dpk
RvDesign.dpk
dclRave.dpk 在線等,解決後送高分!
解决方案 »
- dll调用,两种写法有什么区别吗?
- 程序与CPU和内存
- 奇怪的循环!!困扰中,请高手帮忙
- 有关双核64位CPU上安装Delphi7的问题,100分送上
- 用delphi开发的游戏"赏图历险II"准备发布了
- 嘴角急的冒泡! 报表问题 a component named QRStandardPreview already exist
- 报表的打印
- ***********是男人的就进来看看,不知道不要紧!*********
- 请问如何在DBgrid中选中一行后使该行所有列变为同一颜色?在线等待!!!
- 一个关于Assigned函数的问题?请进!(30)
- SQL中,select 查询到的值为空怎么判断
- 这个资源怎样释放?
lk