Purpose: So once you have installed mediawiki and are up and running, you might want to learn how to embed a MS Excel file in your wiki page. In this blog post we will learn exactly how to do that. However note that you will be just displaying the excel file on your wiki page but you won’t be able to edit it from the wiki page. Basically, we will be embedded a MS Excel document in your wiki page.

So let’s get started…

Step 1: Download “embed” extensions

First you need to download the mediawiki extension for embedded document and copy it in your mediawiki’s extensions directory:

# cp embed_document.php /var/lib/mediawiki/extensions/

In mediawiki, most of these add-on features are achieved using extensions. In short if you are interested in getting other extensions for mediawiki you can simply do:

# apt-get install mediawiki-extensions

Step 2: Create a MS Excel file

Simply create an excel file (say test.xls) in Windows and save it with an extension of “.htm” (test.htm)File->Save As->Save as type. The good thing about this is that you can edit the excel file with “.htm” just as if you were editing a “.xls” file. You simply won’t note the difference. Yes, we simply cannot embed a “.xls” file in mediawiki with this method. We need to first convert first the “.xls” file into HTML code so that we can embed into mediawiki. Saving the file as “.htm” automatically takes care of this conversion and it works beautifully.

Note: Do not try to convert the .xls file into HTML in Open Office. It really makes the formatting look bad. So saving it as .htm in Windows is recommended specially if you are using tables, line, borders, etc. in your file.

Step 3: Upload the excel file on your mediawiki server

Simply upload/copy the “.htm” file on your mediawiki sever where it can accessible publicly. For example, I copied my excel files at the following location:

# /var/www/wiki/docs/test.htm

Step 4: Embed the file in wiki page

Finally, we are all set to embed the file in your wiki page.

Simply put the following code in your wiki page in which you would like your excel file to appear:

<embed_document width="100%" height="900">/wiki/docs/test.htm</embed_document>

Note that my mediawiki’s root directory is located at:

# /var/www/wiki/

You may need to adjust the path appropriately depending on how you installed mediawiki.

Simply refresh your wiki page and you should be able to see the contents of your excel file.

That’s it!

Happy Embedding!

Be Sociable, Share!