Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Sun May 28, 2017 11:43 am
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: OpenOffice on Linux
PostPosted: Tue Jul 03, 2012 5:41 pm 
Offline

Joined: Fri Sep 14, 2007 5:00 pm
Posts: 408
Hey, I am trying to find an example of how to create a file then open that file with OpenOffice.calc or OpenOffice.writer (depending on the need).

1. Can it be done
2. If yes, then how?

All the examples for office related stuff is for Windows. Doesn't help me as I am on Linux.

Thanks again! :D


Top
 Profile  
 
 Post subject: Re: OpenOffice on Linux
PostPosted: Tue Jul 03, 2012 7:30 pm 
Offline
User avatar

Joined: Mon Apr 02, 2007 2:08 am
Posts: 1225
Location: San Francisco, CA, USA
Something like:

Dim sh As New Shell
Dim myDoc As FolderItem
sh.Execute("soffice -o" + myDoc.AbsolutePath)


should work, and should be cross-platform.


Edit: fixed typo

_________________
Boredom Software


Last edited by charonn0 on Wed Jul 04, 2012 6:10 pm, edited 3 times in total.

Top
 Profile  
 
 Post subject: Re: OpenOffice on Linux
PostPosted: Wed Jul 04, 2012 2:02 am 
Offline

Joined: Mon Sep 26, 2011 11:44 pm
Posts: 6
charonn0 wrote:
Something like:

Dim sh As New Shell
Dim myDoc As FolderItem
sh.Execute("soffice -o" + SomeFolderItem.AbsolutePath")


should work, and should be cross-platform.

should be more like:
Dim sh As New Shell
Dim myDoc As FolderItem
sh.Execute("soffice -o" + " $HOME/Documents/test.xls") using Bash variable and assuming the text.xls file exists :) . Notice the space before $HOME, very important
What if the person's shell is not Bash? Well, this is not a perfect world. One size does not fit all.


Top
 Profile  
 
 Post subject: Re: OpenOffice on Linux
PostPosted: Wed Jul 04, 2012 2:33 am 
Offline

Joined: Fri Jan 06, 2006 3:21 pm
Posts: 12388
Location: Portland, OR USA
No, charonn0 had it right. There's an implied elipsis in his code.
Dim sh As New Shell
Dim myDoc As FolderItem
...
// get an existing file into myDoc
...
sh.Execute("soffice -o" + SomeFolderItem.AbsolutePath") // should probably be ShellPath

Instead of relying on $HOME and bash, use RB constructs like SpecialFolder.Documents, etc., to get a FolderItem. Then use its ShellPath.


Top
 Profile  
 
 Post subject: Re: OpenOffice on Linux
PostPosted: Wed Jul 04, 2012 12:26 pm 
Offline

Joined: Mon Sep 26, 2011 11:44 pm
Posts: 6
No, charonn0 was not right. Look at that original code again. Do you always use a closing" without an opening"? And I tested it BEFORE I posted it. Yes, I am right, now go away.


Top
 Profile  
 
 Post subject: Re: OpenOffice on Linux
PostPosted: Wed Jul 04, 2012 6:06 pm 
Offline
User avatar

Joined: Mon Apr 02, 2007 2:08 am
Posts: 1225
Location: San Francisco, CA, USA
defconmatrix wrote:
No, charonn0 was not right. Look at that original code again. Do you always use a closing" without an opening"? And I tested it BEFORE I posted it. Yes, I am right, now go away.

That was a typo; he was referring to the idea. Why so hostile?

_________________
Boredom Software


Top
 Profile  
 
 Post subject: Re: OpenOffice on Linux
PostPosted: Thu Jul 05, 2012 12:36 pm 
Offline

Joined: Fri Sep 14, 2007 5:00 pm
Posts: 408
Cool! Thanks! So my next question is do you think Office Automation will come to other systems than Windows? I was reading up on it and would really like to start creating .ods and .xls files from my application. Currently I have the .csv figured out really well.


Top
 Profile  
 
 Post subject: Re: OpenOffice on Linux
PostPosted: Thu Jul 05, 2012 11:13 pm 
Offline
User avatar

Joined: Sun Aug 12, 2007 10:10 am
Posts: 1086
Location: Boiling Springs, SC
Why not just drop a "template" into your project explorer then write the template to disk as file? ..remember files dropped into the ide are stored as a string.. Simply create a text output stream..any file name... With the extention of the xls odt (or any other) and write
OpenOffice template file to disk? ;-) For a Linux system..you could write a command line utility to generate the files or write a class to generate the template files and store the base64encoded template in strings within the class for 'ease-of-use' in other projects. where there's a will...

_________________
Matthew A. Combatti
Real Studio 2012 r1.2

Visit Xojo Developer's Spot!
Systems I Use:
Windows XP/Windows Vista/Windows Server 2008 r2/Windows 7/Windows 8
Mac OSX 10.5/Mac OSX 10.6/Mac OSX Server/Ubuntu/Debian/Suse/Red Hat/
Windows Server 2011/CentOS 5.4 /ReactOS/SimOS

~All Xojo Compatible~


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group