How to associate files with PlayOnLinux installed MS Office

Though there is LibreOffice for Ubuntu, lots of time we deal with documents that created by MS office and some time those file does not open properly with LibreOffice, specially if those contains lots of equation and figure. There is a very good solution, you can install MS Office with wine, Specially with Play On Linux. Play On Linux automatically configure wine and downloads all the required libraries, so that MS Office works fine. You can install MS Office 2003, 2007 and 2010 with Play On Linux. Play On Linux creates shortcut in desktop from where you can easily lunch so files. But only problem is that neither MS Office packages (Like Word, Excel, Power Point) shows up in application search on dash nor it appear in right click and open with option. But with some effort you can make it work properly as native app.

You have to create two desktop file for each Office program (Word, Excel etc). One each for associating with particular file type and other for program to be appear in dash search.

Creating .desktop file:
To create a desktop file run the following code in terminal,
gnome-desktop-item-edit ~/.local/share/applications/ --create-new
Then one window will open up. First enter the name of the luncher (like Word 2010) and then in the command box enter the following code,
playonlinux --run "Microsoft Word 2010"
For other program like Excel 2010 you can use Microsoft Excel 2010 instead of Microsoft Word 2010. Obviously if you have different office version use that instead of 2010.

After doing all this your MS Office program will shows up in dash search.

Associating file type with MS Office:
This step will bring word 2010 in right click open with option. Then create a .docx (suppose filename.docx) file in your home folder. Now open a terminal and run the following code.
mimeopen -d filename.docx
now among the options, choose the number that says other. It will give you option to use custom command. Enter the following command.
playonlinux --run "Microsoft Word 2010" z:%f
Now this will try to open the document in word but this time it will not work properly. Don't worry! When you are completely done this will work properly. Now go to ~/.local/share/application from file manager. You will find a file named something like "playonlinux_userdefined" change the name to something like "word.desktop" or "word_2010.desktop". The extension name should be .desktop and remember that what ever the name you will provide here will appear in the right click and open with option.

Make it work properly:
Unfortunately what ever you have done till will not work if there is a space in file or folder name. But it can be fixed. Open folder named ~/.playonlinux/shortcuts. Now open all short-cut with gedit. At the end of the file you will find some code like this.
$@
Change it to following code,
"$(echo "$@" | sed -e 's:/*/:\\:g')"
Now this should work properly.

Enjoy microsoft word in Linux with wine.

Cheers
A.Paul

Comments

Popular posts from this blog

Changing caption width in latex

Subtitle in latex

Placing float (table or figure) at the top of the page in otherwise empty page in LaTeX