Save OpenOffice files as MS Word document

Hi,

Could anyone show me how to use Ruby to convert a .sxw file to .doc properly?

I’ve tried the following but it doesn’t work as MS office can’t open the .doc:

src_url = "file:/#{MyDoc.doc}".gsub( /\\/, '/' )
dest_url = "file:/#{MyDoc.sxw}".gsub( /\\/, '/' )
serviceManager = WIN32OLE.new("com.sun.star.ServiceManager")
desktop = serviceManager.createInstance("com.sun.star.frame.Desktop")
document = desktop.loadComponentFromURL(src_url, "_default", 0, [])
document.storeAsURL( dest_url, [] )

Thanks
PS: Converting from .doc to .sxw worked just fine using this code, so I’m confused.

Philip

I wonder: maybe is OOo itself that does the conversion badly? does it
work if the process is done with the actual program instead of ole ?

···

il 11 Mar 2004 17:07:04 -0800, qewrty@netscape.net (Memory Seeker) ha scritto::

Hi,

Could anyone show me how to use Ruby to convert a .sxw file to .doc properly?

I’ve tried the following but it doesn’t work as MS office can’t open the .doc:

src_url = “file:/#{MyDoc.doc}”.gsub( /\/, ‘/’ )
dest_url = “file:/#{MyDoc.sxw}”.gsub( /\/, ‘/’ )
serviceManager = WIN32OLE.new(“com.sun.star.ServiceManager”)
desktop = serviceManager.createInstance(“com.sun.star.frame.Desktop”)
document = desktop.loadComponentFromURL(src_url, “_default”, 0, )
document.storeAsURL( dest_url, )

Thanks
PS: Converting from .doc to .sxw worked just fine using this code, so I’m confused.

gabriele renzi surrender_it@remove.yahoo.it wrote in message news:o463501c0jo2r2ralmttp2bi7arj1bcg45@4ax.com

il 11 Mar 2004 17:07:04 -0800, qewrty@netscape.net (Memory Seeker) ha
scritto::

Hi,

Could anyone show me how to use Ruby to convert a .sxw file to .doc properly?

Thanks
PS: Converting from .doc to .sxw worked just fine using this code, so I’m confused.

I wonder: maybe is OOo itself that does the conversion badly? does it
work if the process is done with the actual program instead of ole ?

Using the actual program works fine. I probably just need to supply
the proper flags for the StoreAsUrl call, but couldn’t find out how.

Philip