mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 06:39:12 +02:00
LazReport: implements adding the file extension of export filter to exported report in case the user do not supply one, patch from Aleksey Lagunov
git-svn-id: trunk@52543 -
This commit is contained in:
parent
8edded4e25
commit
ad4616bb77
@ -875,11 +875,25 @@ end;
|
|||||||
|
|
||||||
function TfrPreviewForm.ExportToWithFilterIndex(AFilterIndex: Integer;
|
function TfrPreviewForm.ExportToWithFilterIndex(AFilterIndex: Integer;
|
||||||
const AFileName: string):boolean;
|
const AFileName: string):boolean;
|
||||||
|
var
|
||||||
|
S, S1:string;
|
||||||
|
i: SizeInt;
|
||||||
begin
|
begin
|
||||||
if (AFilterIndex<0) or (AFilterIndex>=ExportFilters.Count) then
|
if (AFilterIndex<0) or (AFilterIndex>=ExportFilters.Count) then
|
||||||
raise exception.Create(sExportFilterIndexError);
|
raise exception.Create(sExportFilterIndexError);
|
||||||
ConnectBack;
|
ConnectBack;
|
||||||
TfrReport(Doc).ExportTo(ExportFilters[AFilterIndex].ClassRef, AFileName);
|
|
||||||
|
S:=Trim(AFileName);
|
||||||
|
if (S <> '') and (ExtractFileExt(S) = '') and (S[Length(S)]<>'.') then
|
||||||
|
begin
|
||||||
|
S1:=ExportFilters[AFilterIndex].FilterExt;
|
||||||
|
i:=Pos('.', S1);
|
||||||
|
if i>0 then
|
||||||
|
Delete(S1, 1, i-1);
|
||||||
|
S:=S+S1;
|
||||||
|
end;
|
||||||
|
|
||||||
|
TfrReport(Doc).ExportTo(ExportFilters[AFilterIndex].ClassRef, S);
|
||||||
Connect(Doc);
|
Connect(Doc);
|
||||||
Result:=true;
|
Result:=true;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user