Linux安全网 - Linux操作系统_Linux 命令_Linux教程_Linux黑客

会员投稿 投稿指南 本期推荐:
搜索:
您的位置: Linux安全网 > Linux培训 > » 正文

转:HOW-TO: Get Office 2003 running in Wine on Linux

来源: 未知 分享至:

HOW-TO: Get Office 2003 running in Wine on Linux

I\'ve gotten Microsoft Office 2003 working pretty well, if you would like to get Office working in Ubuntu 8.04, here\'s what you need to do.

First, you\'ll need to install wine. This can be done using the Add/Remove applet on your menu, or by entering this command in a terminal window:

sudo apt-get install wine

Now that Wine\'s installed, you\'ll need to download the core Windows fonts and set them aside for later, so go grab each of the MS Core fonts .exe packages from sourceforge [ HERE ]. You can safely skip wd97vwr32.exe which is the Microsoft Word 97 viewer.

Now, insert your Office 2003 CD and execute SETUP.EXE. I recommend browsing to the setup directory, and then performing the following action in nautilus:

Right Click SETUP.EXE
Select \"Open With\"
Click the arrow next to \"Use a custom command\"
Type \"wine\" in the textbox (without quotes)
Press \"Open\"

You may see your hard drive light start to flash, but no notification that it\'s doing anything. That\'s OK, it\'s working and the installer will start momentarilly.

Install Microsoft Office normally, note that Outlook currently does not work with the version of Wine that ships with Ubuntu 8.04.

Once the Office installation completes, perform the following actions (Note: For Office 2007, change OFFICE11 to OFFICE12):

Press Alt-F2 (this brings up a RUN prompt)
Type \"regedit\" (without quotes)
Click \"Run\"
Browse to: HKLMSoftwareMicrosoftOffice11.0CommonFilesPaths
Change the path to MSO.DLL to: C:Program FilesCommon FilesMicrosoft SharedOFFICE11MSO.DLL
Close Regedit

Press Alt-F2
Type \"winecfg\" (without quotes)
Click the Libraries tab
Click the \"New override for library\" dropdown box
Select \"gdiplus\"
Click \"Add\"
Click \"Ok\"

This tells Office where to find the MSO dll, and sets GDI to native mode. Now we need to install those fonts.

Open a terminal by clicking Applications -> Accessories -> Terminal
Change to the directory containing your exe files downloaded earlier. I\'ll assume they are in ~/Desktop (the default download path)
Type: \"cd ~/Desktop\" (without quotes)
Type: \"for item in *exe; do wine $item; done\" (without quotes)

For each of the dialog boxes, accept the license or click through the OK when prompted.

Now that you have Office installed, we\'ll need to associate it in GNOME. We\'ll do this by creating shell scripts which will perform actions based on how it\'s called. We\'ll need to repeat this step for Word, Excel, Powerpoint, etc. In our example we\'ll use Word and Excel.

In your terminal window:
Type: \"cd\"
Type: \"mkdir bin\"
Type: \"cd bin\"
Type: \"gedit\"

This brings up the Gnome Text Editor. Paste the following code blocks into gedit and save as the appropriate \"NAME\".

Paste the following and save in your bin directory as \"word\":
#!/bin/bash
COMMAND=`echo $* | sed -e s#/#\\\\\\#g`
if [ ${COMMAND} ]; then
COMMAND=\'Z:\'$COMMAND
fi
wine \"C:Program FilesMicrosoft OfficeOFFICE11WINWORD.EXE\" \"${COMMAND}\"

Paste the following and save in your bin directory as \"excel\":
#!/bin/bash
COMMAND=`echo $* | sed -e s#/#\\\\\\#g`
if [ ${COMMAND} ]; then
COMMAND=\'Z:\'$COMMAND
fi
wine \"C:Program FilesMicrosoft OfficeOFFICE11EXCEL.EXE\" \"${COMMAND}\"

Repeat this for any other Office applications you would like to use, be sure to change the .EXE to the appropriate Office executable (I\'ve tested with Word, Excel, Powerpoint, and Access which all seem to work OK.

Next, we\'ll need to make icons for your new Word, and Excel installation. Do a quick Google search for Icons to use for your Office applications I found some cool ones on deviant art icons like these linked [ HERE ] should work great. Rename each of them to Word.{extension}, Excel.{extension}, etc substituting \"{extension}\" with the actual file\'s real extension (Example: Word.png). To create icons on the Gnome menu we\'ll perform the following actions:

Close Gnome Editor
In your Terminal window, type: \"gksu gedit\"
Enter your password when prompted.

Paste the following text into Gnome Editor, and save it to the /usr/share/applications directory with the name \"word.desktop\". Be sure to change the name of the Icon in the \"Icon\" line below to match your downloaded icon. Don\'t change the directory to the Icon.

[Desktop Entry]
Version=1.0
Terminal=false
Exec=wine \"c:/Program Files/Microsoft Office/OFFICE11/WINWORD.EXE\" %U
Icon=/usr/share/pixmaps/Word.png
Type=Application
Categories=Application;Office;WordProcessor;
StartupNotify=false
InitialPreference=5
Name=Microsoft Word
GenericName=Word Processor

Paste the following text into Gnome Editor, and save it to the /usr/share/applications directory with the name \"excel.desktop\". Be sure to change the name of the Icon in the \"Icon\" line below to match your downloaded icon. Don\'t change the directory to the Icon.

[Desktop Entry]
Version=1.0
Terminal=false
Exec=wine \"c:/Program Files/Microsoft Office/OFFICE11/EXCEL.EXE\" %U
Icon=/usr/share/pixmaps/Excel.png
Type=Application
Categories=Application;Office;Spreadsheet;
StartupNotify=false
InitialPreference=5
Name=Microsoft Excel
GenericName=Spreadsheet

Now that you have desktop files, we need to put the icons into the /usr/share/pixmaps directory. Copy them from wherever they were downloaded and renamed to your home directory. Once they are there, lets close Gnome Editor and go back to your Terminal window.

Type: \"cd\"
Type: \"sudo mv *{extension} /usr/share/pixmaps\" where {extension} is the real extension of your files. IE: \"sudo mv *png /usr/share/pixmaps\"

Now, click Applications -> Office, and you should see Word and Excel. Open each of them to verify they are working correctly.

Lastly, we need to associate .doc and .xls files with Word and Excel. Browse to those types of files in your home directory (or your thumb drive, wherever you store them).

In nautilus, right click a .doc file
Select \"Open with Other Application\"
Click the arrow next to \"Use a custom command\"
Click \"Browse\"
Click your home directory in the left pane
Click bin
Click \"word\"
Click \"Open\"
Click \"Open\"

Your word document should open in Microsoft Word 2003. This also saves this configuration, associating .doc files with Word permanently. If you are installing Office 2007 update to the latest version of Wine from winehq.

Repeat for Excel, and any other Office programs.
Posted by FEWT at 3:57 PM
Email ThisBlogThis!Share to TwitterShare to Facebook
Labels: Linux, Office, Ubuntu, Wine
6 comments:

shamess said...

I got Office 2007 working too, so you can use that if you prefer.

I could even get World of Warcraft working, but I guess my machine wasn\'t fast enough to be emulating and running that. Unfortunately that was a show stopper for me (I\'m a terrible addict) so I had to come back to Windows until I find a hard drive I can use.
June 30, 2008 5:02 AM
∑?Δ?S said...

Hey thanks for the Post i tried and it worked. I was wondering if i can do the same thing for gtalk application.
September 4, 2008 4:38 PM
Anonymous said...

This method worked with one exception to get powerpoint viewer up and running on Ubuntu 8.04.

The application icon in my office directory works; the powerpoint interface opens .ppt files as expected.

However, if I follow the method you describe for file associations and double click on a .ppt file, PowerPoint Viewer tells me it cannot find the file.
After double-checking the contents of my powerpoint script in /home/myusername/bin/, I tried to reset the custom command under Microsoft PowerPoint in the \'open with\' menu.
I get the message \"could not find /home/myusername/bin/powerpoint \"

Any idea as to what I\'m doing wrong?
July 3, 2009 9:16 AM
Anonymous said...

I took the %U out of the path to open program and that took care of \"unable to find file\" problem.

The thing that is not working for me is the .png image doesn\'t show up right under applications menu, they turn into a window icon and all of them are same, just different names
August 1, 2009 3:02 AM
Anonymous said...

Nevermind. All fixed! Had name of icon typed wrong in program.desktop file.
August 1, 2009 3:09 AM
Anonymous said...

Hi !.
might , perhaps curious to know how one can manage to receive high yields .
There is no need to invest much at first. You may begin earning with as small sum of money as 20-100 dollars.

AimTrust is what you haven`t ever dreamt of such a chance to become rich
The company incorporates an offshore structure with advanced asset management technologies in production and delivery of pipes for oil and gas.

Its head office is in Panama with offices around the world.
Do you want to become really rich in short time?
That`s your chance That`s what you wish in the long run!

I feel good, I started to take up real money with the help of this company,
and I invite you to do the same. If it gets down to choose a proper partner who uses your savings in a right way - that`s the AimTrust!.
I take now up to 2G every day, and my first deposit was 1 grand only!
It`s easy to join , just click this link http://cafadoqemo.lookseekpages.com/ytezesy.html
and go! Let`s take our chance together to feel the smell of real money
December 3, 2009 4:58 PM

Post a Comment
Newer Post Older Post Home

Tags:
分享至:
最新图文资讯
1 2 3 4 5 6
验证码:点击我更换图片 理智评论文明上网,拒绝恶意谩骂 用户名:
关于我们 - 联系我们 - 广告服务 - 友情链接 - 网站地图 - 版权声明 - 发展历史