Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

PowerBuilder and OpenOffice

646 views
Skip to first unread message

Frederic Geraerds

unread,
Feb 7, 2007, 5:08:15 AM2/7/07
to
Hi,

I'm looking for sample code writting with PowerBuilder that call OpenOffice
on a windows computer.

What I want to do is : open a existing OpenOffice document, add some text
and save it with another fileName.

Thanks for your help

Mitch

unread,
Feb 7, 2007, 7:14:33 AM2/7/07
to

Mitch

unread,
Feb 7, 2007, 7:16:56 AM2/7/07
to
OpenOffice API/SDK: http://api.openoffice.org/

Frederic Geraerds

unread,
Feb 20, 2007, 9:19:06 AM2/20/07
to
Hello,
Thanks for your response, but anybody has another exemple ?

I don't understand anything in the API documentation.
For exemple, I suppose that I need XComponentLoader (supports simple api for
loading components into the frame environment)
http://api.openoffice.org/docs/common/ref/com/sun/star/frame/XComponentLoader.html

But I didn't see how to create it.

I find an exemple in Java, that open a calc document, but I dont understand
how to convert this in PB script.

try {
// get the remote office component context
xRemoteContext = com.sun.star.comp.helper.Bootstrap.bootstrap();
System.out.println("Connected to a running office ...");
xRemoteServiceManager = xRemoteContext.getServiceManager();
}
catch( Exception e) {
e.printStackTrace();
System.exit(1);
}
try {
// get the Desktop, we need its XComponentLoader interface to load a
new document
Object desktop = xRemoteServiceManager.createInstanceWithContext(
"com.sun.star.frame.Desktop", xRemoteContext);
// query the XComponentLoader interface from the desktop
XComponentLoader xComponentLoader =
(XComponentLoader)UnoRuntime.queryInterface(
XComponentLoader.class, desktop);
// create empty array of PropertyValue structs, needed for
loadComponentFromURL
PropertyValue[] loadProps = new PropertyValue[0];
// load new calc file
XComponent xSpreadsheetComponent =
xComponentLoader.loadComponentFromURL(
"private:factory/scalc", "_blank", 0, loadProps);
// query its XSpreadsheetDocument interface, we want to use
getSheets()
XSpreadsheetDocument xSpreadsheetDocument =
(XSpreadsheetDocument)UnoRuntime.queryInterface(
XSpreadsheetDocument.class, xSpreadsheetComponent);

Any information that can help me?

Thanks


Mitch

unread,
Feb 20, 2007, 12:07:34 PM2/20/07
to

Frederic Geraerds

unread,
Feb 21, 2007, 3:39:30 AM2/21/07
to
This is the same exemple.
I search anything else to understand how that works.


<Mitch> a écrit dans le message de news:
45db2ad6.193...@sybase.com...

Frederic Geraerds

unread,
Feb 21, 2007, 5:53:58 AM2/21/07
to
Hy,
I find what I want to do with an example write in VB; Thanks to the autor.

So this is the exemple that open an existing file and save it to MS Word :

// Création du Service Manager
// -----------------------------
OLEObject objServiceManager
objServiceManager = CREATE OLEObject
IF objServiceManager.ConnectToNewObject("com.sun.star.ServiceManager") < 0
Then
messagebox("OLE Error", "Cound not connect to Open Office")
End IF

// Create the Desktop
// --------------------
OLEobject objDesktop
objDesktop= objServiceManager.createInstance("com.sun.star.frame.Desktop")

// Load File from disk
// -------------------
String args[]
String ls_url
ls_url = "file:///" + "myfile.sxw" // Specify file name correctly
on you HD
OLEobject objDoc
objDoc = objDesktop.loadComponentFromURL(ls_url, "_blank", 0, args)

// Create PropertyValue for save
// -------------------------------
OLEObject objPropertyValue[]
objPropertyValue[1] =
objServiceManager.Bridge_GetStruct("com.sun.star.beans.PropertyValue")
objPropertyValue[1].Name = "FilterName"
objPropertyValue[1].Value = "MS Word 97"
String ls_newUrl
ls_newUrl = "file:///" + "myfile.doc" // Specify new file name
correctly
objDoc.storeToURL(ls_newUrl, objPropertyValue[])

// Close file
// ---------
objDoc.dispose()

// Free object
// ------------
objServiceManager.disconnectobject()
destroy objServiceManager


pierrem...@gmail.com

unread,
Nov 14, 2014, 9:00:07 AM11/14/14
to
Hello,
I'm looking for a documentation about how to implement OpenOffice functions in Powerbuilder code.
Some examples like Frederic's are quite welcome.
I need to:
- select a sheet
- rename a sheet
- select a column
- delete a column
- change format of cels
-...
Thanks in advance
Best regards

bruce.arm...@gmail.com

unread,
Jan 23, 2015, 1:10:52 PM1/23/15
to
These google groups were originally feeds from the Sybase NNTP server. That server was shut down on March 28, 2013. Questions are now handled in the SAP Community Network PowerBuilder Developer Center:

http://scn.sap.com/community/developer-center/powerbuilder/content?filterID=contentstatus%5Bpublished%5D~objecttype~objecttype%5Bthread%5D
0 new messages