I can't load a report from a MemoryStream lazarus / 21-General ---------------------------------------------------------------------- babycode · 2024-07-16 13:08 I'm trying to load a resource from a TMemoryStream using the function: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i function ExtrairRecursosMemoria(NomeRecurso: String): TStream;var  Recurso: TLResource;  StreamRecurso: TLazarusResourceStream;  MemStreamRecurso: TMemoryStream;begin  Result := nil;  StreamRecurso := nil;   Recurso := LazarusResources.Find(NomeRecurso);   if Recurso = nil then  begin    raise Exception.Create('Recurso com nome "' + NomeRecurso + '" não foi encontrado.');  end;   begin    try      try        StreamRecurso := TLazarusResourceStream.Create(NomeRecurso, nil);        MemStreamRecurso := TMemoryStream.Create;        MemStreamRecurso.CopyFrom(StreamRecurso, StreamRecurso.Size);        MemStreamRecurso.Position := 0;        Result := MemStreamRecurso;    except            on E: Exception do            begin               ShowMessage('Error')            end;      end;    finally      StreamRecurso.Free;    end;  end;end; I use the function as follows: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i var  ReportStream: TStream; begin      ReportStream := ExtrairRecursosMemoria('history');      try        try           ReportStream.Position := 0;           frlrRelatorioHistorico.LoadFromStream(ReportStream);           frlrRelatorioHistorico.ShowReport;         except            on E: Exception do            begin               ShowMessage('Error')          end;         end;      finally          MemStreamRecurso.Free;    end;end; When I try to extract I get an error "invalid binary report: invalid report version (60)". But if I save the physical file and load it from disk it works normally. ---------------------------------------------------------------------- korba812 · 2024-07-16 13:22 You should use LoadFromXMLStream method instead of LoadFromStream. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i frlrRelatorioHistorico.LoadFromXMLStream(ReportStream); ---------------------------------------------------------------------- babycode · 2024-07-16 13:43 It worked very well! Grateful!