* Discard design data when rdoManageData is not in design options (Bug ID #33325)

git-svn-id: trunk@57524 -
This commit is contained in:
michael 2018-03-17 17:25:17 +00:00
parent 46f0729085
commit c1d42d53ff

View File

@ -1292,10 +1292,13 @@ begin
// Write report
WS.JSON:=TJSONObject.Create;
FReport.WriteElement(WS);
if rdoManageData in DesignOptions then
begin
// Add design data
DD:=TJSONObject.Create;
WS.JSon.Add('DesignData',DD);
FReportDesignData.SaveToJSON(DD);
DD:=TJSONObject.Create;
WS.JSon.Add('DesignData',DD);
FReportDesignData.SaveToJSON(DD);
end;
// Now save to file
fs:=TFileStream.Create(AFilename, fmCreate);
S:=WS.JSON.FormatJSON();
@ -1445,12 +1448,15 @@ begin
rs := TFPReportJSONStreamer.Create(nil);
rs.JSON := lJSON; // rs takes ownership of lJSON
try
DD:=lJSON.Get('DesignData',TJSONObject(Nil));
if Assigned(DD) then
FReportDesignData.DataDefinitions.LoadFromJSON(DD);
// We must do this before the report is loaded, so the pages/bands can find their data
Errs:=TStringList.Create;
CreateReportDataSets(Errs);
if rdoManageData in DesignOptions then
begin
DD:=lJSON.Get('DesignData',TJSONObject(Nil));
if Assigned(DD) then
FReportDesignData.DataDefinitions.LoadFromJSON(DD);
// We must do this before the report is loaded, so the pages/bands can find their data
Errs:=TStringList.Create;
CreateReportDataSets(Errs);
end;
FReport.ReadElement(rs);
if (FReport.Owner<>Self) and (OldName<>'') then
FReport.Name:=OldName;