秋·风

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

一、修正fastreport for lazarus(linux)的Bug - 秋·风 - 博客园 (cnblogs.com)
二、【记录一下】修正lazarus fr报表控件在linux不能使用QRcode的Bug - 秋·风 - 博客园 (cnblogs.com)

三、如果应用项目从delphi转换到lazarus,使用fastreport在linux打开报表设计器时软件会闪退。
在终端使用管理员运行时出现以下信息:

打开lpr文件,添加红框内容,重新编译就可以。

 
四、当日期类型为空时,在IDE运行时会有以下提示(不在IDE运行应用不会出现这错误)

修复方法:
打开frxClass.pas,定位到function TfrxCustomMemoView.FormatData(const Value: Variant; AFormat: TfrxFormat = nil): WideString;
          if DecSepPos > 0 then // replace dec seporator
            Result[DecSepPos] := WideChar(AFormat.DecimalSeparator[1]);
        end;

      fkDateTime:
        Result := FormatDateTime(AFormat.FormatStr, Value);

      fkBoolean:
        if Value = True then
           Result := Copy(AFormat.FormatStr, Pos(',', AFormat.FormatStr) + 1, 255) else
           Result := Copy(AFormat.FormatStr, 1, Pos(',', AFormat.FormatStr) - 1);
      else
        Result := VarToWideStr(Value)
将16655行改为:
          if DecSepPos > 0 then // replace dec seporator
            Result[DecSepPos] := WideChar(AFormat.DecimalSeparator[1]);
        end;

      fkDateTime:
        if value<>'' then
          Result := FormatDateTime(AFormat.FormatStr, Value)
        else Result:='';

      fkBoolean:
        if Value = True then
           Result := Copy(AFormat.FormatStr, Pos(',', AFormat.FormatStr) + 1, 255) else
           Result := Copy(AFormat.FormatStr, 1, Pos(',', AFormat.FormatStr) - 1);
      else
        Result := VarToWideStr(Value)

五、打开报表设计器时有出错提示:
Could not create directory "\Software\".

 1、打开frxClass.pas,定位到procedure TfrxReport.LoadFromStream(Stream: TStream);
找到

SaveIni := FIniFile;//20711行(2023.1.3版本)

改为:

  SaveIni :={$IFNDEF FPC}FIniFile{$ELSE}GetLazIniFile{$ENDIF};
    except
      Crypter.Free;
      FErrors.Add(frxResources.Get('clDecryptError'));
      frxCommonErrorHandler(Self, frxResources.Get('clErrors') + #13#10 + FErrors.Text);
      Exit;
    end;
  end;

  SaveEngineOptions := TfrxEngineOptions.Create;
  FEngineOptions.PrintIfEmpty := True;
  SaveEngineOptions.Assign(FEngineOptions);
  SavePreviewOptions := TfrxPreviewOptions.Create;
  SavePreviewOptions.Assign(FPreviewOptions);
  SaveIni := {$IFNDEF FPC}FIniFile{$ELSE}GetLazIniFile{$ENDIF};//2023.1.3版本为20711行
  SavePreview := FPreview;
  SaveOldStyleProgress := FOldStyleProgress;
  SaveShowProgress := FShowProgress;
  SaveStoreInDFM := FStoreInDFM;
  FStreamLoaded := True;
  try

2、找到:function TfrxReport.GetIniFile: TCustomIniFile;按下面的修改 (2024-07-24更新)

function TfrxReport.GetIniFile: TCustomIniFile;
begin
  {$IFNDEF FPC}
  if Pos('\Software\', FIniFile) = 1 then
    Result := TRegistryIniFile.Create(FIniFile)
  else
    Result := TIniFile.Create(FIniFile);
  {$endif}
  {$IFDEF LCLGTK2}
    Result := TIniFile.Create('tmp/fr6.ini');
  {$ENDIF}
end;

 

 

六、网友发现如果交叉编译出来的应用在打开报表设计器时还是出现同样的提示(2024-02-19修正)。
修正有2个方案:
1、将inifile清空

2、修改frxClass.pas

打开frxClass.pas找到
function TfrxReport.GetLazIniFile: string; 和function TfrxReport.GetIniFile: TCustomIniFile;
添加红字代码:

{$IFDEF FPC}
function TfrxReport.GetLazIniFile: string;
var
  bw,bl:Boolean;
begin
  bw := Pos('\', FIniFile) > 0;
  bl := Pos('/', FIniFile) > 0;
  {$IFDEF LCLGTK2}
    if bw then
      Result := 'tmp/fr6.ini'
    else
      Result := FIniFile;
    if Result.StartsWith('\Software\Fast Reports') then
    begin
      FIniFile:= 'tmp/fr6.ini';
      Result := FIniFile;
    end;
  {$ELSE}
     if bl then
       Result := '\Software\Fast Reports'
     else
       Result := FIniFile;
  {$ENDIF}
end;
{$ENDIF}
function TfrxReport.GetIniFile: TCustomIniFile;
begin
  {$IFNDEF FPC}
  if Pos('\Software\', FIniFile) = 1 then
    Result := TRegistryIniFile.Create(FIniFile)
  else
  {$ENDIF}
  {$ifdef LCLGTK2}
  if FIniFile.StartsWith('\Software\Fast Reports') then
  begin
    FIniFile:= 'tmp/fr6.ini';
  end;
  {$endif}
  Result := TIniFile.Create(FIniFile);
end;

修改后重新编译就可以。

posted on 2023-09-27 11:41  秋·风  阅读(569)  评论(0编辑  收藏  举报