Avemey / zexmlss

ZEXMLSS Lazarus/Delphi component for read/write ods, excel xml, xlsx
http://avemey.com/zexmlss/index.php
Other
72 stars 53 forks source link

Master не собирается в Lazarus 2.2.3 / FPC 3.2.3 #46

Open the-Arioch opened 2 years ago

the-Arioch commented 2 years ago

При попытке скомпилировать пакет ошибки

zexml.inc(25,5) Error: Incompatible types: got "AnsiString" expected "Extended"
zexml.inc(25,5) Error: Compile time expression: Wanted Boolean but got <erroneous type> at IF or ELSEIF
zexml.inc(25,5) Error: Incompatible types: got "AnsiString" expected "Extended"
zexml.inc(25,5) Error: Compile time expression: Wanted Boolean but got <erroneous type> at IF or ELSEIF

исправление

// Archivers for Delphi, not used for Free Pascal / Lazarus
// Архиваторы для Delphi, не используются для Free Pascal / Lazarus
+++ {$IFNDEF FPC}
{ use Delphi XE2 and above }
{$if CompilerVersion >= 23.0}         // bds xe2 (2012)
  {$define XE2ZIP}
{$ifend}

и потом

{ use Synopse }
{//$define SYNZIP}
+++ {$EndIf}

// Free Pascal / Lazarus
{$IFDEF FPC}
the-Arioch commented 2 years ago
zexmlss.pas(6068,21) Error: Incompatible types: got "Pointer" expected "TZEPicture"

исправление

function TZEPictureStore.GetItem(num: integer): TZEPicture;
begin
  Result := nil;
  if ((num >= 0) and (num < Count)) then
---    Result := FItems[num];
+++    Result := TObject(FItems[num]) as TZEPicture;
end;

Забавно, что в другом месте преобразование есть.

function TZEPictureStore.Delete(num: integer): boolean;
....
    TZEPicture(FItems[num]).Free();

TZEPicture(FItems[num])

the-Arioch commented 2 years ago
zexlsx.pas(587,14) Error: Identifier not found "TTmpFileStream"

и потом

zexlsx.pas(7335,17) Error: Identifier not found "TTmpFileStream"

и его таки действительно нигде нету, вот вообще нигде... даже в Гугле нету!

procedure TXSLXZipHelper.DoCreateOutZipStream(Sender: TObject; var AStream: TStream; AItem: TFullZipFileEntry);
begin
  {$ifdef MSWINDOWS}
  AStream := TTmpFileStream.Create();
  {$else}
  AStream := TMemoryStream.Create();
  {$endif}
end;
the-Arioch commented 2 years ago
zeSaveXLSX.pas(36,13) Error: Wrong number of parameters specified for call to "ExportXmlssToXLSX"
zexlsx.pas(7288,10) Error: Found declaration: ExportXmlssToXLSX(var TZEXMLSS;AnsiString;const {Open} Array Of LongInt;const {Open} Array Of AnsiString;TAnsiToCPConverter;AnsiString;AnsiString;Boolean=`FALSE`):LongInt;

Сломано в 2d5c04df4b4365b42109c083e6bcc7509eea1c51

Если уж решили делать свой Zip - то надо его было во всей библиотеке делать, а не кусками

Теперь получается довольно идиотская картинка, ODS делается одной zip-библиотекой, а XLSX-другой. Шиза...

the-Arioch commented 2 years ago

You totally did not test 2d5c04df4b4365b42109c083e6bcc7509eea1c51 in FPC/Laz - did you?

ALL the saving into XLSX in FPC is broken!!! ALL the contents of XLSZ archive are zero length files!

Really... How you merge such things...

zexmlss.Vanilla\zexmlss\src\zexlsx.pas

function ExportXmlssToXLSX(

    ZEXLSXCreateDocPropsCore(XMLSS, TmpStream, TextConverter, CodePageName, BOM);

    zip.ZipAllFiles();
  finally

You can not just go like that!!! You have to reset stream positions back to zero!!!

zeZippy was diligently cheecking and doing it - it was in the open!

Why you removed it and did not even tested if it works any more - is beyond me.

    ZEXLSXCreateDocPropsCore(XMLSS, TmpStream, TextConverter, CodePageName, BOM);

    for i := 0 to zip.Entries.Count - 1 do
      with zip.Entries[i] do begin
        if nil = Stream then
           Continue;
        Stream.Position := 0;
      end;

    zip.ZipAllFiles();
  finally
    StreamList.Free();