2,7 → 2,7 |
|
(* |
* ASCII Table and CSV Generator Delphi Unit |
* Revision 2022-07-11 |
* Revision 2022-07-10 |
* |
* (C) 2022 Daniel Marschall, HickelSOFT, ViaThinkSoft |
* Licensed under the terms of Apache 2.0 |
90,10 → 90,8 |
Cont: array[0..VTS_ASCII_TABLE_COLS-1] of string; |
Align: array[0..VTS_ASCII_TABLE_COLS-1] of TAlignment; |
PadChar: array[0..VTS_ASCII_TABLE_COLS-1] of char; |
DoSum: array[0..VTS_ASCII_TABLE_COLS-1] of boolean; |
procedure Clear; |
procedure SetVal(index: integer; ACont: string; AAlign: TAlignment=taLeftJustify; |
APadChar: char=' '; ADoSum: boolean=false); |
procedure SetVal(index: integer; ACont: string; AAlign: TAlignment=taLeftJustify; APadChar: char=' '); |
end; |
|
TVtsAsciiTableAnalysis = record |
141,25 → 139,17 |
objLine: TVtsAsciiTableLine; |
j: Integer; |
analysis: TVtsAsciiTableAnalysis; |
found: boolean; |
begin |
objLine := TVtsAsciiTableLine.Create; |
objLine.IsSumLine := true; |
analysis := GetAnalysis; |
found := false; |
for j := 0 to VTS_ASCII_TABLE_COLS-1 do |
begin |
if analysis.Sum[j] <> 0 then |
begin |
objLine.SetVal(j, IntToStr(analysis.Sum[j]), taRightJustify, ' '); |
found := true; |
end; |
Inherited Add(objLine); |
end; |
if found then |
Inherited Add(objLine) |
else |
objLine.Free; |
end; |
|
function TVtsAsciiTable.GetAnalysis: TVtsAsciiTableAnalysis; |
var |
183,7 → 173,7 |
for j := 0 to VTS_ASCII_TABLE_COLS-1 do |
begin |
len := Length(objLine.Cont[j]); |
if TryStrToInt(objLine.Cont[j], itmp) and objLine.DoSum[j] then |
if TryStrToInt(objLine.Cont[j], itmp) then |
result.Sum[j] := result.Sum[j] + itmp; |
if len > result.MaxLen[j] then |
result.MaxLen[j] := len; |
370,12 → 360,11 |
end; |
|
procedure TVtsAsciiTableLine.SetVal(index: integer; ACont: string; |
AAlign: TAlignment=taLeftJustify; APadChar: char=' '; ADoSum: boolean=false); |
AAlign: TAlignment=taLeftJustify; APadChar: char=' '); |
begin |
Self.Cont[index] := ACont; |
Self.Align[index] := AAlign; |
Self.PadChar[index] := APadChar; |
Self.DoSum[index] := ADoSum; |
end; |
|
end. |