I was using search engine and not just here, and got tired of it; just want a simple answer (or a link) for a simple question:
How do I open a calc sheet and write 123 into cell A1 from Delphi (7) code? (Or any hello worlds for calc?)
Ok, after some research and using the informations above for I thank yas a lot, here is a simple answer:
uses part
Uses ComObj, OOoMessages, OOoTools, OOoConstants, OOoXray;
main code
open blank document, write 'hello 123' text into a1 then save it on desktop
procedure HelloWorldExample;
var
mentesiOpciok,oSheet,oSheets,myCalc : Variant;
begin
ConnectOpenOffice;
myCalc:=StarDesktop.loadComponentFromURL('private:factory/scalc', '_blank', 0, dummyArray);
oSheets:=myCalc.getSheets;
oSheet:=oSheets.getByIndex(0);
//oSheet.getCellByPosition(0, 0).SetValue(123);
oSheet.getCellByPosition(0, 0).SetFormula('hello 123!');
mentesiOpciok:=CreateProperties(['FilterName', 'MS Excel 97']);
myCalc.storeToURL('file:///C:/Documents and Settings/Zéiksz/Asztal/calcdoc.xls', mentesiOpciok);
showMessage('kész :)');
myCalc.close(true);
DisconnectOpenOffice();
end;
use getcellbyposition(...).setvalue to set numeric values, or setformula for strings (not really sure, but there is a string in it LOL).
Péter
edit: most useful information I found on the Internet is in this forum: http://www.oooforum.org/forum/viewtopic.phtml?t=4996