RM报表,点击保存,为何每次都显示 另存为的对话框?

时间:2023-03-09 15:11:51
RM报表,点击保存,为何每次都显示 另存为的对话框?
function TRMDesignerForm.FileSave: Boolean;
var
lSaved: Boolean;
lFileName: string;
begin
Result := False;
if DesignerRestrictions * [rmdrDontSaveReport] <> [] then Exit; if not FCodeMemo.ReadOnly then
Report.Script.Assign(FCodeMemo.CreateStringList); UseDefaultSave := True;
if (not (csDesigning in Report.ComponentState)) and (RMDesignerComp <> nil) and
Assigned(RMDesignerComp.OnSaveReport) then // 自定义保存
begin
lFileName := CurDocName; lSaved := True;
RMDesignerComp.OnSaveReport(Report, lFileName, False, lSaved);
if lSaved then
begin
Modified := False;
CurDocName := lFileName;
Result := True;
end;
end; if (not Result) and UseDefaultSave then
begin
if AnsiCompareText(FCurDocName, RMLoadStr(SUntitled)) <> then //关键是这里,当报表文件名 是默认的
begin
Report.SaveToFile(FCurDocName);
Modified := False;
SetOpenFileMenuItems(FCurDocName);
Result := True;
end
else
Result := FileSaveAs; //关键是这里,当报表文件名 是默认的
end; if Result then begin ClearUndoBuffer; ClearRedoBuffer; end; end;