Ubuntu 13.04 Installing Office

This article describes where I stand on using Microsoft Office in Linux.  This time, I tried to explore a little more, so I walk you through what I tried and what didn’t work.

Office Running on Ubuntu 13.04

Installing Office 2007

In the past, I have used Play on Linux.  This time, I decided to go back to my previous post where I was helping a friend out.

I installed a few prerequisites:

sudo apt-get install mesa-utils mesa-utils-extra libgl1-mesa-glx:i386 libgl1-mesa-dev ia32-libs
sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/mesa/libGL.so
sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so /usr/lib/i386-linux-gnu/libGL.so
sudo add-apt-repository ppa:ubuntu-wine/ppa
sudo apt-get update
sudo apt-get install wine

Currently, I have Wine’s version 1.6:


skp@pecan:~$ wine --version
wine-1.6-rc2

Next, I created a Wine Prefix separate and special for my office.  Now, here I made a mistake, but I decided to leave it alone.  Accidentally, I placed a “2010” in the prefix name when the version I was installing version  2007.  Please don’t let that confuse you.

export WINEPREFIX="$HOME/.wineprefixes/office2010/"
export WINEARCH="win32"

I used winetricks to install a few requisites into the Wine Prefix.

winetricks dotnet20 msxml6 corefonts

Then, I ran winecfg and set the gdiplus and msxml6 to native.

Setting the Libraries to prepare for installing

Next, I used WineTricks to install Internet Explorer 7.  My hope was that this would help with the Online actions that Office tries to do.  I am not sure that it really did help, but it didn’t hurt.

winetricks ie7

Finally, I put the CD into the drive and ran the install…

wine office12CD/OFFICE12/setup.exe

This time, I didn’t screenshot all of the install steps, but I just basically walked through the wizard.  After installing, I opened up Word where it asked for my Name/Initials and it made me activate.

What Wine Prefixes Am I Using?

Since I played around so much, I ended up with a couple of Wine Prefixes installed.  And, I have lost track of which one I am using.  So, I thought it would be a good exercise to launch it from the Unity menu and see if I can figure out what I am using.

With it launched, I found the Process ID with ps:


$ ps -ef | grep -i winword
skp 26973 1 1 11:07 ? 00:00:06 C:\Program Files\Microsoft Office\Office12\WINWORD.EXE
skp 27163 16217 0 11:12 pts/2 00:00:00 grep --color=auto -i winword

Then, I found the Wine Prefix for that running program from the environment variables used when it started:


skp@pecan:~/Downloads/worddocs$ xargs --null --max-args=1 echo < /proc/26973/environ | grep "^WINEPREFIX="
WINEPREFIX=/home/skp/.wineprefixes/office2010

I could even tell what Desktop file was used by the launcher:


skp@pecan:~/Downloads/worddocs$ xargs --null --max-args=1 echo < /proc/26973/environ | grep "^GIO_LAUNCHED_DESKTOP_FILE="
GIO_LAUNCHED_DESKTOP_FILE=/home/skp/.local/share/applications/wine-Programs-Microsoft Office-Microsoft Office Word 2007.desktop

Then, I could see what the path was and get an idea of what version of Wine was running with these commands:


skp@pecan:~/Downloads/worddocs$ sudo readlink -f /proc/26973/cwd
/home/skp
skp@pecan:~/Downloads/worddocs$ sudo readlink -f /proc/26973/exe
/usr/bin/wine-preloader

As an alternative, I launched Word from Play On Linux, and it showed me the alternate Wine version and Wine Prefix.


skp@pecan:~/Downloads/worddocs$ ps -ef | grep -i winword
skp 3898 3235 3 17:39 ? 00:00:02 WINWORD.EXE
skp 12181 16217 0 17:41 pts/2 00:00:00 grep --color=auto -i winword
skp@pecan:~/Downloads/worddocs$ xargs --null --max-args=1 echo < /proc/3898/environ | grep "^WINEPREFIX="
WINEPREFIX=/home/skp/.PlayOnLinux//wineprefix/Office2007
skp@pecan:~/Downloads/worddocs$ sudo readlink -f /proc/3898/cwd
/home/skp/.PlayOnLinux/wineprefix/Office2007/drive_c/Program Files/Microsoft Office/Office12
skp@pecan:~/Downloads/worddocs$ sudo readlink -f /proc/3898/exe
/home/skp/.PlayOnLinux/wine/linux-x86/1.2.3/bin/wine-preloader

Open with…

One of the things I have always wanted to figure out is how to get the “Open with” context menu to work with Wine.  Unfortunately, I haven’t figured it out yet.

Here’s what I have now.  The old “doc” format, has two “Word” options in the context menu:

Doc Open with menu

The new “docx” format, has different options:

docx Open with menu

I found the mime type that the system is using:


cd /usr/share/mimelnk/application
grep '^Patterns=.*doc' *
grep "^MimeType=" libreoffice-openxmlformats-officedocument-wordprocessingml-document.desktop

The result I got for docx was:

MimeType=application/vnd.openxmlformats-officedocument.wordprocessingml.document

Then, I looked for all .desktop files that had this Mime in it.  I wrote a little shell script to do so:

#!/bin/sh

extension=$1
echo "Searching for extension $extension"
cd /usr/share/mimelnk/application

mimeFile=`grep -il "^Patterns=.*\*\.$extension" *`
if [ "$?" -ne 0 ]
then
	echo "Mime not found"
	exit 1
fi
echo "MimeFile: $mimeFile"
mimeType=`grep "^MimeType=" "$mimeFile" | sed "s/^MimeType=//"`
echo "Mime Type: $mimeType"

for f in `locate \*.desktop`
do
	grep -i ^MimeType=.\*$mimeType "$f" > /dev/null
	if [ "$?" -eq 0 ]
	then
		echo $f
	fi
done

The output looked like this:


skp@pecan:~/Downloads/worddocs$ ./mimeSearch.sh docx
Searching for extension docx
MimeFile: libreoffice-openxmlformats-officedocument-wordprocessingml-document.desktop
Mime Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document
/usr/lib/libreoffice/share/xdg/writer.desktop
/usr/share/app-install/desktop/calligraactive:calligraactive.desktop
/usr/share/app-install/desktop/calligraauthor:kde4__author.desktop
/usr/share/app-install/desktop/calligrawords:kde4__words.desktop
/usr/share/app-install/desktop/libreoffice-writer:libreoffice-writer.desktop
/usr/share/app-install/desktop/webservice-office-zoho:webservice-office-zoho-writer.desktop
/usr/share/applications/libreoffice-writer.desktop
/usr/share/mimelnk/application/libreoffice-openxmlformats-officedocument-wordprocessingml-document.desktop

Those don’t seem to match what I have on the menu, and none of them look like a Wine Word installation.  So, I think I am missing something.

Adding a Default Code Style

I normally paste a lot of Code or Command-Line Output into my documents.  Rather than creating a “Code” style in every document, I finally wised up and added the Style to the Global Template (Normal.dotm).

You can find this template in C:\users\<username>\Application Data\Microsoft\Templates.

Normal Template Location

So, I opened Word and used the Open command to open the Normal.dotm.

Opening Normal.dotm

Then, I created a new Style.  On the Style bar, I clicked the more button:

Styles expand button

Then, I clicked the new style button:

New Style button

I gave my new Style a name, “Code”, and I edited the character properties on the main screen:

Updating Character Styles

This is what I changed:

  • Font: “Courier New”
  • Size: 9 pt

Then, I opened up the paragraph properties with: Format button > Paragraph…

Updating Paragraph Properties

On the paragraph properties, these are the changes that I made.

  • Line Spacing: Single
  • checked “Don’t add space between paragraphs of the same style”

After saving it, every document I create has this new style.

Issues

Office works, at least Word and Excel, works well for the most part.  There are a few hiccups.  I thought that I would list them here in hopes that maybe at some point down the road, I could come back and see them fixed.

First, every time I exit Word, it crashes.  It doesn’t seem to cause any problems.  The documents close and save first.  I just have to remember to uncheck the box so that it doesn’t start back up.

Crash When Closing

Second, all of the online actions don’t work.  That’s not a big deal.  It just means the online updates probably don’t work.  Also, the online Clip Art search works.

For example, I can search clip art for “Dog”, and it returns a result:

Word Clip Art

This is all fine and good except that, I had told it to include the Web collections in the search.  Are you telling me no pictures of Dogs exist in the Web Collections?  I think the online access just doesn’t work from Word.

Clip Art Collections

If it click on the online link for clip art, it opens an Internet Explorer Window, but it never connects.  It just sits like that for a long time.

Online Clip Art Link

Office 2013

Just recently, I got access to Office 2013 through my work.  I couldn’t get it installed, but I thought I would document as far as I got with hopes that things will change.

First, I created a new Wine Prefix specifically for the new version.  I also installed Internet Explorer into it because the download page is picky.

Here are the commands so far:

export WINEPREFIX="$HOME/.wineprefixes/office2013/"
winetricks dotnet20 msxml6 corefonts

Next, I ran Internet Explorer to try to download it:

wine "C:\Program Files\Internet Explorer\iexplore"

Office 365 Login in IE under Wine

I didn’t get anywhere with that.  IE had too many issues.  So, I decided to install Firefox inside of Wine.  Office apparently just requires Windows to download not IE.

winetricks firefox

I was able to login and download the setup file.  Then, I could run it using Wine.  Apparently, this file just downloads the full install.

I tried running winecfg and changing it to both Windows 7 or Windows 8.  Both gave me this result:

Office 2013 install error

Here are some of the output messages that I saw on the command line:


err:ole:CoGetClassObject class {dcb00c01-570f-4a9b-8d69-199fdba5723b} not registered
err:ole:CoGetClassObject class {dcb00c01-570f-4a9b-8d69-199fdba5723b} not registered
err:ole:create_server class {dcb00c01-570f-4a9b-8d69-199fdba5723b} not registered
fixme:ole:CoGetClassObject CLSCTX_REMOTE_SERVER not supported
err:ole:CoGetClassObject no class object {dcb00c01-570f-4a9b-8d69-199fdba5723b} could be created for context 0x17

...

p11-kit: couldn't load module: /usr/lib/i386-linux-gnu/pkcs11/gnome-keyring-pkcs11.so: /usr/lib/i386-linux-gnu/pkcs11/gnome-keyring-pkcs11.so: cannot open shared object file: No such file or directory
fixme:shell:SetCurrentProcessExplicitAppUserModelID L"Microsoft.Office.15.ClickToRun": stub

It didn’t close after it showed the error.  I had to find the process and kill it… ps -ef | grep -i office

I tried to install gnome-keyring: i386

http://askubuntu.com/questions/127848/wine-cant-find-gnome-keyring-pkcs11-so

The class not registered error seems to be related to this bug:
http://www.winehq.org/pipermail/wine-bugs/2012-April/319924.html

http://bugs.winehq.org/show_bug.cgi?id=30384

Resources

Leave a Comment

Your email address will not be published. Required fields are marked *