5

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.

8 Answers 8

7

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.

4

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..

2

Since I tried in 2012 and failed, there now is a solution! Once Office2007 has been installed, it will place Icons for Word, Excel and Powerpoint on the desktop. These are *.desktop files. They also need to be in folders that nautilus recognizes as associations:

cp ~/Desktop/Microsoft\ *.desktop ~/.local/share/applications/

Now I can right-click on a file, select Properties, "Open With" tab, click on "Microsoft Word 2007" and then the "Set as default" button. From now on, opening such a file opens it in word. Bingo!

Running on Ubuntu 14.04 with playonlinux 4.2.2-1

A little unrelated, but one more thing that was missing from my new Office 2007 installation, is that typing :-)<TAB> gets replaced with a tiny square instead of the smiley character that it should be. That is because the WINGDING.TTF font file is missing. The original from Microsoft is copyrighted, but you can use a free version:

cp ~/Downloads/wingding.ttf ~/.PlayOnLinux/wineprefix/Office2007/drive_c/windows/Fonts/
0

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.

1
  • Thanks for the quick reply but this is the problem, Word is not listed as an application under 'Other Application'.
    – MrMule
    Jun 6, 2012 at 12:01
0

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

1
  • 1
    I don't think this is that easy. Microsoft Word may not be in the installed. There will be only WINE
    – Anwar
    Oct 9, 2012 at 16:45
0

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') .

0

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.

-1

Another great option is to right click on the file you would like to open and then click on "PlayOnLinux".

Ensure the file associations in PLAYONLINUX are correctly set.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .