Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have installed MS Office 2010 on Ubuntu 12.04 using PlayonLinux. Now to open a .docx file I have to first open Word and then use open to open the file I want. When I double click on the file it opens with LibreOffice instead.

So how can I set Word as the default application? Word also doesn't show up in the application list.

share|improve this question

6 Answers 6

up vote 7 down vote accepted

First of all, you need to have PlayOnLinux 4.1.1 (It won't work with 4.0.x)

To upgrade PlayonLinux to latest version, go to this link : http://www.playonlinux.com/en/download.html

Choose ubuntu, and follow the instructions regarding your distribution.

Then go to PlayOnLinux options -> File associations (.docx -> Microsoft Word 2010) You need to enter separately each file type (xls,xlsx,dox,docx) and to associate it with the corresponding office program.

Then, tell Ubuntu to open .docx files with playonlinux. (you can do this by the usual icon right click)

If you want to make the opening of office files permanent, with MS Office, you should right click on a .doc, .docx,... and go to properties-> open with-> playonlinux set as default. You have to do this separately for each file type.

share|improve this answer

Solution

Visit: http://ubuntuforums.org/showthread.php?t=1940522

BY: forrestcupp

Preface: This is a howto, not a question.

Today, after beating my brains out trying to install Office 2007 with Wine 1.4 in Precise, I ended up resorting to using PlayOnLinux. What I learned about PlayOnLinux is that it makes installing things a dream, but it makes the general usability of those things an absolute nightmare. When I had Office 2007 installed with Wine, I could easily set filetype associations in Nautilus to Word and Excel. When I installed Office 2007 in PlayOnLinux, it didn't leave any way to associate filetypes. Also, PlayOnLinux created nice shortcuts to the apps on the desktop, but it didn't create any gnome-desktop launchers that will show up in Dash in Unity or Gnome Shell.

After a lot of hard work and headaches, I finally figured out how to do both of those things, so I thought I would share that experience for future reference, and for anyone else who might need it.

When you are preparing to do this, be aware that you will have to create two separate .desktop files for each Office program (Word, Excel, etc.). The first section creates a .desktop file so that a new instance of Word can be launched from the Dash. The second section creates a second .desktop file for associating file types.

Creating a .desktop launcher file

This creates a .desktop file so that a new instance your Office programs can be launched from Dash.

Open a terminal, and enter this command: Code:

gnome-desktop-item-edit ~/.local/share/applications/ --create-new

In the window that comes up, first enter a name for your launcher. For Microsoft Word, we'll enter Microsoft Word as the name. Then in the "Command" box, for Word 2007, we'll enter this code Code:

playonlinux --run "Microsoft Word 2007"

For Excel 2007, you would enter "Microsoft Excel 2007" leaving the quotes in it. For anything else, you just would put whatever app name shows up in the PlayOnLinux window, and put that name in quotes. After this, you can click on the icon and use the file browser to point it to whatever icon you want to use for that launcher.

After doing this, your app launcher should show up by doing a Dash search.

Associating files with MS Office that was installed with PlayOnLinux

This creates a second .desktop file for associating your file types.

Step 1 - creating a .desktop launcher for association

Since PlayOnLinux installed apps don't show up in the "Open With" dialog in Nautilus, you have to create a custom command for Nautilus. This used to be easy to do with the GUI, but since they changed to Gnome 3 in 11.10, you can't do that anymore. Never fear, that's why we have the command line. Open a terminal, and cd to a folder that has a .doc or .docx file. Once you're in that folder, note the name of your Word document file, and type: Code:

mimeopen -d filename.doc

Of course you would type .docx if that's what type of file it is. When you type this, it will give you options of what you want the default app to be for that file. Enter whatever number says "Other" so that you can enter a custom command. For that custom command, enter the following for Word 2007: Code:

playonlinux --run "Microsoft Word 2007" z:%f

Note, that it will try to open the file with Word, and at this point it will not work. By the time you're done, it will work properly when you double click it in Nautilus.

Now open up Nautilus, press Ctrl+H if hidden files aren't showing, and navigate to ~/.local/share/applications and find the .desktop launcher file with something like "playonlinux_userdefined" in the name. Change that name to something like Word.desktop. Now you can right-click on a .doc or .docx file, go to Properties, and go to the "Open With" tab, click "Show Other Applications" and find "Word.desktop" in the list. Now, that filetype is associated with Word, and you can go through all of those steps again substituting the right names for Excel and Powerpoint.

Step 2 - making it work properly

Unfortunately, what you just did won't work if there are spaces in the file or folder names. But we can fix that, too.

Open Nautilus and navigate to ~/.PlayOnLinux/shortcuts. Double click on each of the shortcuts that were made for Word, Excel, and Powerpoint, and choose to Display the file in Gedit. At the end of the script, you should find this code: Code:

$@

Change that code for the following code in each shortcut script, and save the files. Code:

"$(echo "$@" | sed -e 's:/*/:\\:g')"

Make sure you leave the quotes in. That code will take the path and filename and convert any spaces to be readable by Word, Excel, or Powerpoint when you open the file.

Since both desktop files will show up in a Dash search, I suggest not assigning an icon to this one to prevent confusion.

Now, you should be able to navigate to any MS Office file in Nautilus, double click on it, and it will open properly.

I'm not an expert, and this is just the findings of my experience. Hopefully it works for you, too.

Edit: I found all of this information scattered all over the net, but I need to give credit to wojox for helping me fix a problem with the bash code I found for the shortcut script.


Today you are You, that is truer than true. There is no one alive who is Youer than You. - Dr. Seuss Last edited by forrestcupp; May 3rd, 2012 at 07:46 AM..

share|improve this answer

Right click on the docx document and choose the option Open with different application... (or similar). Edit: You can try this with other document types too.

share|improve this answer
    
Thanks for the quick reply but this is the problem, Word is not listed as an application under 'Other Application'. –  MrMule Jun 6 '12 at 12:01
    
OK, you're welcome. –  Feratile Jun 6 '12 at 15:46

In Dolphin (KDE4) you can rightclick -> properties on any docx-file. You should see "Type: Microsoft Word Document" On the very right side should be a small icon (wrench) you can press and change order of programms to open this with, or add new entries. On my system (Office 2010 Pro, wine 1.5.14) I had three entries: LibreOffice Writer|Microsoft Word|Ark

Changed it to: Microsoft Word|LibreOffice Writer|Ark

Now doubleclick works. docx opens with Word 2010

share|improve this answer
1  
I don't think this is that easy. Microsoft Word may not be in the installed. There will be only WINE –  Anwar Shah Oct 9 '12 at 16:45

Many thanks, it works fine and it is really fantastic. Just a little update for the shortcut script to make it work perfectly :

$(echo "$@" | sed -e 's:/*/:\\\:g')

instead of $(echo "$@" | sed -e 's:/*/:\:g') .

share|improve this answer

I install it through Wine Windows Program Loader rather than Playonlinux. I used Playonlinux for games.

Installing Microsoft Office.

You can double click it or right click and have easy access to the Microsoft Office Document.

Double click or right click

But I recommend to you to used Libre Office which is default of Ubuntu and it's easier to use and have plenty nice feature compared to Microsoft Office. Have a Nice day! Thanks.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.