How to: insert workbook in WordPress
January 16, 2011 Leave a comment
While embedding Excel on a web page is pretty easy, doing it in WordPress.com is a little tricky.
The problem: Excel Web App embedding is done using an iframe, and WordPress.com strips out iframes for security reasons, except from sites that are whitelisted.
The solution (which you can do even w/o understanding the problem :-)) is below.
- While editing the post, switch to HTML mode
- Paste the HTML markup you got from the file in http://office.live.com
- Click Save Draft
Once you’ve saved the draft, you can continue working as you usually do, preview the post, continue editing it, publish it, etc. The important thing is to save the draft immediately after pasting the HTML code. Otherwise, WordPress will strip it out.
Doing “Save Draft” changes the iframe code to a different code, that is not stripped out by WordPress. For example:
<iframe src=”http://r.office.microsoft.com/r/rlidExcelEmbed?su=89268436867536320&Fi=SD13D252B9D24D5C0!111&AllowInteractivity=False” width=”402″ height=”346″ frameborder=”0″ scrolling=”no”>
Is replaced by:
[office src=”http://r.office.microsoft.com/r/rlidExcelEmbed?su=89268436867536320&Fi=SD13D252B9D24D5C0!111&AllowInteractivity=False” width=”402″ height=”346″]
First of all, the trick above and the notes below are based on my own experience and trial and error. I couldn’t find any official documentation for this. If you have experienced anything else, of have more information, please enter a comment.
As far as I can tell, this issue (and workaround) is only relevant for WordPress.com. Self-hosted WordPress seems not to strip iframe so it doesn’t exhibit this issue.
Using Windows Live Writer to post to your WordPress.com blog also seems to work just fine.