[Lazarus] Anyone has experience controlling Excel from FPC/delphi via OLE Automation?

Dennis dec12 at avidsoft.com.hk
Wed Oct 5 18:19:07 CEST 2016



Werner Pamler via Lazarus wrote:
>> I am having problem using the Type Library generated.
>> Don't know how to use it.
>>
>> I tried to 'learn' from old Delphi 5 source code (the only version of 
>> Delphi I have) that worked with Excel 2000 but found that the type 
>> library are so different from the one generated by FPC.
>>
> I try to avoid that OLE stuff as much as possible - too much pain... 
> What is the reason why you want to control Excel? Maybe you can 
> achieve the same in a different way. If it's only reading or writing 
> files you should have a look a fpspreadsheet which covers - I'd say - 
> 90% of what is needed (this is not what Excel offers - Excel has 
> always offered more features than were needed).
>
I hate to use OLE as well but my customer needs to write his own Excel 
spreadsheet formula and VBA routines etc and feed the results every 5 
minutes into my program and my program will execute some tasks 
accordingly and write back the statuses to the Excel spreadsheet.  I 
tried to persuade him to learn pascal or a formal programming language 
but he refused.

By the way, I want to complain about OLE Automation. It must run in the 
main thread. If I run it in an non-main  thread even with locking 
routine (coXXXX ) , it still crashes. I guess some deep down routines in 
OLE just forget to make as thread safe.
> If you insist on Automation you should look at the wiki articles 
> http://wiki.lazarus.freepascal.org/Office_Automation and 
> http://wiki.lazarus.freepascal.org/ExcelAutomation/de - the latter is 
> in German, though.
>
>
I tried fpspreadsheet but it does not support DDE which my customer 
needs. Also, it does not support writing VBA.

Dennis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20161006/8b2be7a1/attachment.html>


More information about the Lazarus mailing list