Recent

Author Topic: FPSpreadsheet: is it possible to install on Delphi?  (Read 398 times)

hamacker

  • New Member
  • *
  • Posts: 21
FPSpreadsheet: is it possible to install on Delphi?
« on: May 24, 2022, 02:38:39 pm »
This is the scenario: Port application Delphi to Lazarus by inside, change components thats exists only Delphi and change to other one that exists in Delphi/Lazarus like Firedac to ZeosLib, it´s easy by the way, but I have HotXLS lib(to create XLS Files) and I think "change to fpspreadsheet". But there is no instruction to install fpspreadsheet on Delphi, only Lazarus.

Is it possible to install fpspreadsheet on Delphi?

Thaddy

  • Hero Member
  • *****
  • Posts: 12209
Re: FPSpreadsheet: is it possible to install on Delphi?
« Reply #1 on: May 24, 2022, 02:53:01 pm »
As is? NO!, not in a reasonable time. If some Delphi guy/girl wants to port it and keep the license? Then ask on a Delphi forum.
(It is not that easy, btw. FpSpreadSheet is quite - this is an understatement - complex to port...in effect a complete spreadsheet API and more...)
« Last Edit: May 24, 2022, 03:01:40 pm by Thaddy »
Manuals, manuals, manuals first.
You have incompetence and sheer incompetence.

wp

  • Hero Member
  • *****
  • Posts: 10297
Re: FPSpreadsheet: is it possible to install on Delphi?
« Reply #2 on: May 24, 2022, 03:26:30 pm »
As Thaddy said, I would not attempt to port fpspreadsheet to Delphi. It uses too many routines buried deeply inside FPC which do not exist in Delphi, e.g. the AVLTree or the expression parser.

If the requirements are not too high you could simply wrap the existing HotXLS calls in a conditional define checking for Delphi or Lazarus and replace each call by the correspoding fpspreadsheet routine in the FPC case. They can't be too different. Or, if you do not want too many IFDEFs in your own application units, write a spreadsheet unit in which you introduce an intermediate layer between your application and those spreadsheet libs. For example (untested, just an idea...):
Code: Pascal  [Select][+][-]
  1. unit MySpreadsheetLib;
  2.  
  3. uses
  4.   {$IFDEF FPC}
  5.     fprspreadsheet, fpstypes, fpsutils
  6.   {$ELSE}
  7.     HotXLS
  8.   {$ENDIF};
  9.  
  10. type
  11.   {$IFDEF FPC}
  12.   TMyworkbook = class(TsWorkbook)
  13.   {$ELSE}
  14.   TMyworkbook = class(THotXLSWorkbook)  // no ideas whether this is their name for a workbook...
  15.   {$ENDIF}
  16.   public
  17.      procedure LoadFromXLS(AFileName: String);
  18.      ....
  19.   end;
  20.  
  21. ...
  22.  
  23. procedure TMyWorkbook.LoadFromXLS(AFileName: String);
  24. begin
  25. {$IFDEF FPC}
  26.   ReadFromFile(AFileName, sfBiff8);
  27. {$ELSE}
  28.   LoadXLSFile(AFileName);  // or whatever it is called by HotXLS
  29. {$ENDIF}
  30. end;
  31.  

Then, in your own application call these itermediate methods rather than the HotXLS methods. This should work in Delphi AND in Lazarus in the same way.

hamacker

  • New Member
  • *
  • Posts: 21
Re: FPSpreadsheet: is it possible to install on Delphi?
« Reply #3 on: May 24, 2022, 04:20:46 pm »
Well, it´s more simple implement addons made in Lazarus/FPC and integrate to Delphi apps.

 

TinyPortal © 2005-2018