Skip to content

Commit

Permalink
Стратегия заполнения таблицы Excel
Browse files Browse the repository at this point in the history
  • Loading branch information
Tango600 committed Oct 20, 2022
1 parent cc5af5a commit 28f4d79
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
3 changes: 2 additions & 1 deletion DCLPlatform/uDCLConst.pas
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ interface
{$IFDEF SQLdb}
DBEngineType='SQLdb (Universal)';
{$ENDIF}
Ver='10.2.13.3';
Ver='10.2.13.4';
VersionS='$VersionSignature$'+Ver+'$';

CompotableVersion='9.1.129.309';
Expand Down Expand Up @@ -373,6 +373,7 @@ interface
TFastReportsScriptLanguage=(fslPascal, fslBasic, fslCppScript, fslJScript);
TINIType=(itNone, itFormPos, itBookmarkMenu);
TFieldFormat=(fftNone, fftDigit, fftDate, fftTime, fftDateTime, fftTrim, fftFloat);
TSheetFillStrategy=(sfsInsert, sfsReplace);

const
ReleaseStatus=rsBetta;
Expand Down
24 changes: 23 additions & 1 deletion DCLPlatform/uUDL.pas
Original file line number Diff line number Diff line change
Expand Up @@ -16500,6 +16500,7 @@ procedure TDCLOfficeReport.ReportExcel(ParamStr: String; Save, Close: Boolean);
RecRepNum, v1: Word;
RowRColor, RowBColor, RowGColor, ColRColor, ColBColor, ColGColor: Integer;
DCLQuery: TDCLDialogQuery;
FillStrategy: TSheetFillStrategy;
begin
{$IFDEF MSWINDOWS}
Ext:='xls';
Expand All @@ -16511,6 +16512,19 @@ procedure TDCLOfficeReport.ReportExcel(ParamStr: String; Save, Close: Boolean);
FindParam('Template=', ParamStr), 'xlsx');
end;

FillStrategy:=sfsInsert;
if FindParam('FillStrategy=', ParamStr)<>'' then
begin
if LowerCase(FindParam('FillStrategy=', ParamStr))='insert' then
begin
//FillStrategy:=sfsInsert;
end else
if LowerCase(FindParam('FillStrategy=', ParamStr))='replace' then
begin
FillStrategy:=sfsReplace;
end;
end;

FileName:=FindParam('Template=', ParamStr);
If not IsFullPath(FileName) then
FileName:=AppConfigDir+FileName;
Expand Down Expand Up @@ -16606,9 +16620,15 @@ procedure TDCLOfficeReport.ReportExcel(ParamStr: String; Save, Close: Boolean);
end;

RecRepNum:=0;
case FillStrategy of
sfsInsert:RecRepNum:=0;
sfsReplace:RecRepNum:=1;
end;
While Not DCLQuery.Eof do
begin
Excel.Sheets[1].Range['DATA'].Rows.Insert(-4121, 1);
if FillStrategy=sfsInsert then
Excel.Sheets[1].Range['DATA'].Rows.Insert(-4121, 1);

For v1:=0 to DCLQuery.FieldCount-1 do
begin
Excel.Sheets[1].Range['DATA'].Cells.Item[RecRepNum, v1+1]:=
Expand All @@ -16623,6 +16643,8 @@ procedure TDCLOfficeReport.ReportExcel(ParamStr: String; Save, Close: Boolean);
Excel.Sheets[1].Range['DATA'].Cells.Item[RecRepNum, v1+1].Interior.Color:=
RGB(ColRColor, ColGColor, ColBColor);
end;
if FillStrategy=sfsReplace then
inc(RecRepNum);
DCLQuery.Next;
end;
DCLQuery.Close;
Expand Down

0 comments on commit 28f4d79

Please sign in to comment.