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:
jesus 2016-06-21 20:23:32 +00:00
parent 8edded4e25
commit ad4616bb77

View File

@ -875,11 +875,25 @@ end;
function TfrPreviewForm.ExportToWithFilterIndex(AFilterIndex: Integer;
const AFileName: string):boolean;
var
S, S1:string;
i: SizeInt;
begin
if (AFilterIndex<0) or (AFilterIndex>=ExportFilters.Count) then
raise exception.Create(sExportFilterIndexError);
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);
Result:=true;
end;