Как передать данные (текст, таблицу) из программы на Delphi в OpenOffice? Может, кто знает, подскажите или хотя бы где есть какая-л. инфа 

OLE objects
Introduction
The OpenOffice (OO) supports Microsoft's Automation technology on different Windows platforms ( Windows 95,98, ME, 2000, NT4). It enables clients to control the office externally. Client programs can be contained within executables or scripts. In order to make use of the Automation capability, a client must be coded in a programming language that supports Automation. There are a variety of appropriate languages and development environments available, such as Visual C++, Visual Basic, Delphi, VBScript and JScript. In order to use a scripting language one needs a script controller that executes the script. Common controllers are the Internet Explorer as well as the Windows Script Host (WSH).
To give you an impression on how Automation works with OO, here is a quick example:
'The service manager is always the starting point
'If there is no office running then an office is started up
Set objServiceManager= WScript.CreateObject("com.sun.star.ServiceManager")
'Create the Desktop
Set objDesktop= objServiceManager.createInstance("com.sun.star.frame.Desktop")
'Open a new empty writer document
Dim args()
Set objDocument= objDesktop.loadComponentFromURL("private:factory/swriter",_
"_blank", 0, args)
'Create a text object
Set objText= objDocument.getText
'Create a cursor object
Set objCursor= objText.createTextCursor
'Inserting some Text
objText.insertString objCursor, "The first line in the newly created text document."&_
vbLf, false
This script opens a new writer document and inserts some text. If OO is not already running, then an instance is started up automatically.
To run this example put the code into a file named test.vbs and run it with the Windows Script Host (WSH). That can be done by entering the command line:
cscript test.vbs
in a command line window. Alternatively one can double click the file entry in the Explorer (if in doubt, look at the documentation at http://msdn.microsoft.com/scripting/default.htm). As you might have noticed, this examples is written in VBScript but you can also use JScript with the WSH.
OLE Automation
Страницы: 1
Предыдущая тема: DBGrid?