報表,5行一分頁,
從第五頁開始,分頁錯誤,第五頁,第六頁應該合在一起,不知道為什么分開了,
并且,五六七頁的。本頁合計,也不顯示了。附分頁事件。
function MoneyToCharacter(str: string): string;
var
string1, string2, string3, string4, ch1, ch2, s, s1, rmb: string;
i, j, k, zero: Integer;
begin
string1 := '零壹貳叁肆伍陸柒捌玖';
string2 := '佰拾萬仟佰拾億仟佰拾萬仟佰拾元角分';
s1 := '';
zero := 0;
rmb := '';
try
s := trim(str);
s := format('%.2f', [strtofloat(str)]);
if (strtofloat(s)<0) then
s := Trim(FloatToStr(strtofloat(str) * (-100))) // '將數字轉成整型字串
else
s := Trim(FloatToStr(strtofloat(str) * 100));
j := Length(s); // '字串長度
string4 := copy(string2, Length(string2) - j * 2 + 1, j * 2); // '取出所需最大位數的表示
for i := 1 to j do
begin
string3 := copy(s, i, 1);
ch1 := copy(string1, (StrToInt(string3) + 1) * 2 - 1, 2);
ch2 := copy(string4, i * 2 - 1, 2);
if string3 <> '0' then
zero := 0
else
begin
zero := zero + 1;
if (j - i <> 14) and (j - i <> 10) and (j - i <> 6) and (j - i <> 2) or (zero > 3) and (j - i = 6) then
ch2 := '';
if (copy(s, i, 2) = '00') or (string3 = '0') and (j - i = 14) or (j - i = 10) or (j - i = 6) or (j - i = 2) or (j - i = 0) then
ch1 := '';
end;
rmb := rmb + ch1 + ch2;
if (j - i = 14) or (j - i = 10) or (j - i = 6) or (j - i = 2) then
if (copy(s, i, 1) = '0') and (copy(s, i + 1, 1) <> '0') then
rmb := rmb + '零';
end;
if string3 = '0' then
rmb := rmb + '整';
if (strtofloat(str)<0) then
Result := '負'+rmb
else
Result := rmb;
except
Result := '';
end;
end;
var
PageLine: integer; //在現在頁列印到第幾行
PageMaxRow: integer=5; //設定每頁列數
procedure Footer1OnBeforePrint(Sender: TfrxComponent);
var
i: integer;
begin
i := iif(PageLine=0, PageMaxRow, PageLine);
while i < PageMaxRow do begin
i := i + 1;
Engine.ShowBand(Child1); //印空白表格
end;
end;
procedure MasterData1OnBeforePrint(Sender: TfrxComponent);
begin
PageLine := <line> mod PageMaxRow;
if (PageLine = 1) and (<line> > 1) then
Engine.newpage;
end;
begin
end.
uj5u.com熱心網友回復:
uj5u.com熱心網友回復:
查看一下分頁資料源獲取到的資料轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/84778.html
標籤:VCL組件開發及應用
