If you are a developer like me, you probably prefer working on a Linux based system. However, business sometimes requires you to interact with the well-known and omnipresent Microsoft Office solutions.
While one solution to this problem is using the tools with wine, I recently started to power up my Windows VM in Virtualbox. Some things, like SharePoint integration, just require this setup.
However, often I still create my initial drafts in pandoc and only later export them to the MS Office documents formats.
To ease my workflow between MS Office and other software I normally use outside this VM, i.e. on my Linux host, I created some small desktop files allowing a tight integration from your virtual MS Office products into your Linux desktop. In this post I show you how opening your office documents inside a VM directly from your Linux file manager is possible.
A file named
~/.local/share/applications/Word\ Win7-VM.desktop containing the following allows you to choose
Word Win7-VM as your default application for the specified document.
[Desktop Entry] Name=Word Win7-VM Exec=vboxmanage guestcontrol Win7 --password "YourWindowsPassword" run "C:\Program Files (x86)\Microsoft Office\Office16\WINWORD.EXE" X:%f Type=Application StartupNotify=true Comment=Create beautiful documents, easily work with others, and enjoy the read.
You need to setup your VM such that the network device X: in Windows points to your Linux file system root. In Virtualbox you can easily achieve this with a shared folder. The read-only flag might be set to avoid unintended changes on your root.
After that, you can set the default application for word documents in Linux as
xdg-mime default Word\ Win7-VM.desktop application/vnd.openxmlformats-officedocument.wordprocessingml.document
Obviously you can do the same for Excel (
[Desktop Entry] Name=Word Win7-VM Exec=vboxmanage guestcontrol Win7 --password "YourWindowsPassword" run "C:\Program Files (x86)\Microsoft Office\Office16\EXCEL.EXE" X:%f Type=Application StartupNotify=true Comment=Easily discover, visualize, and share insights from your data.
The call to
xdg-mime sets this new desktop file as the default for the excel file type.
xdg-mime default Excel\ Win7-VM.desktop application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
[Desktop Entry] Name=Word Win7-VM Exec=vboxmanage guestcontrol Win7 --password "YourWindowsPassword" run "C:\Program Files (x86)\Microsoft Office\Office16\POWERPNT.EXE" X:%f Type=Application StartupNotify=true Comment=Design and deliver beautiful presentations with ease and confidence.
The call to
xdg-mime sets this new desktop file as the default for the power point file type.
xdg-mime default PowerPoint\ Win7-VM.desktop application/vnd.openxmlformats-officedocument.presentationml.presentation
In all these setups, finally, clicking on a file results in opening the respective MS office documents in your VM.