Page 1 of 1
Export to Excel
Posted: Tue Sep 10, 2013 7:54 am
by omni
Roger,
we have a large client that (due to remote users and licensing issues) wants to open files in a spreadsheet with Openoffice instead of excel.
Do we have a method to do this, or one you can suggest? (ie, would runshell work with the file name as the option, something like that)
Thanks
Fred
Omni
Re: Export to Excel
Posted: Tue Sep 10, 2013 8:12 am
by Auge_Ohr
hi,
do you mean activeX ?
Code: Select all
oServiceManager := CreateObject("com.sun.star.ServiceManager")
while OpenOffice use a Array for Parameter you must use something like this
Code: Select all
oHidden := MakeProperty( "Hidden", TRUE )
LoadArgs := VTType():New( {oHidden}, VT_ARRAY+VT_VARIANT )
you also need to use CoreReflection Class to create Structure
Code: Select all
oCoreReflection := oServiceManager:createInstance("com.sun.star.reflection.CoreReflection")
and create a new Instance
Code: Select all
oDesktop := oServiceManager:createInstanceWithArguments("com.sun.star.frame.Desktop", LoadArgs )
before you can load a empty Sheet
Code: Select all
oDocument := oDesktop:loadComponentFromURL("private:factory/swriter", "_blank", 0, LoadArgs )
and begin to fill it.
Re: Export to Excel
Posted: Tue Sep 10, 2013 9:59 am
by bwolfsohn
omni wrote:Roger,
we have a large client that (due to remote users and licensing issues) wants to open files in a spreadsheet with Openoffice instead of excel.
Do we have a method to do this, or one you can suggest? (ie, would runshell work with the file name as the option, something like that)
Thanks
Fred
Omni
Fred,
If you have your file associations set to open office, it will work...
you can test it on one of their machines by just typing in the file name at a dos prompt after changing file associations.
Re: Export to Excel
Posted: Tue Sep 10, 2013 10:08 am
by omni
Not sure I was clear..
we are using excel1.prg (from Rogers example, slightly revised) to open dbf files in excel. We have a couple dozen that are on the menu for some specific reports, or they can export any database from our database list on one of the menu options.
We check to be sure excel is installed first, so the remote users cannot get past that because they have openoffice instead.
So, can the excel program be changed to just use openoffice instead, or do we need to use the options that Augie suggested, which without some review, is more than I know about openoffice. Or is there another option that may be used.
Thanks
Fred
Re: Export to Excel
Posted: Tue Sep 10, 2013 1:58 pm
by bwolfsohn
Fred,
A couple of points:
1. If a file can be opened in excel 2003 or earlier, it can be opened in openoffice. i use openoffice myself. the files are interchangeable as long as they are saved in .xls format. i do not know about office 2007 or office 2010.
2. The roadblock seems to be in the function checking for excel. that function needs to be changed to check for either excel or openoffice. then, if you were using runshell before (sending only the filename.xls), you should not have to change it.
3. I'm not sure what you mean by: "So, can the excel program be changed to just use openoffice".
If you are creating an excel file from express, and saving it as a .xls file, you s/b good to go.. if you are using activex to interactively do "stuff", then i don't have a clue...
i hope this helps..
Re: Export to Excel
Posted: Fri Sep 13, 2013 1:39 pm
by omni
We are opening a dbf file and saving as an xls file. In our initial testing today we can open a file just by typing in "scalc file.dbf" and it opens (with proper paths for each). There is only a prompt for character set, which is the default that comes up. We can handle that...openoffice says that the charset option is not available to define in their docs. So, that we can do but will let the user pick the save file name, unless they have an option for that..have not gotten that far yet.
Next question relates to the method used to extrapulate the columns for reports and put them in a spreadsheet (like printopt does). Any thoughts if that can work at all..anybody?
Fred
Re: Export to Excel
Posted: Fri Sep 13, 2013 2:53 pm
by bwolfsohn
Fred,
I think you meant to type scalc file.xls instead of scalc file.dbf..
once you set the file association for .xls to open office scalc, you should be able to just type file.xls and it should open.
if open office has been installed properly, the file association should already be set.
in your program, you should be able to do a runshell with the full path and filename of the .xls file.. i.e.
c:\temp\file.xls
hth