Including MS Word in a DIV

0 views
Skip to first unread message

Ralph Shnelvar

unread,
Nov 22, 2010, 7:17:45 AM11/22/10
to rubyonra...@googlegroups.com
Let's say that I have an MS Word document saved as an HTML document.

I want to present this document as a div; that is, make the MS HTML
sort of a partial.

Is there a RoR facility to do so?

--
Posted via http://www.ruby-forum.com/.

Walter Lee Davis

unread,
Nov 22, 2010, 9:06:38 AM11/22/10
to rubyonra...@googlegroups.com
You're going to need to strip off everything except the content of the
Body tag, and you're going to need to police what is inside the body
for illegal constructs that could blow up the rest of your page. That
means maybe something like Nokogiri to parse the HTML into an internal
DOM tree, then print the body tag back out as a stream.

I would say your best bet is to simply generate a partial that holds
an iframe, targeted to the MSWord "html" file. That will at least
sandbox that code and keep it from wreaking havoc with your layout.

Walter

> --
> You received this message because you are subscribed to the Google
> Groups "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-
> ta...@googlegroups.com.
> To unsubscribe from this group, send email to rubyonrails-ta...@googlegroups.com
> .
> For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
> .
>

Ralph Shnelvar

unread,
Nov 23, 2010, 10:28:02 AM11/23/10
to rubyonra...@googlegroups.com
Walter Davis wrote in post #963121:

>
> I would say your best bet is to simply generate a partial that holds
> an iframe, targeted to the MSWord "html" file. That will at least
> sandbox that code and keep it from wreaking havoc with your layout.
>
> Walter

Thank you, Walter. Until you mentioned it, I didn't even know that
iFrames existed.

Using an iFrame was relatively easy.

Thank you!

Ralph

Reply all
Reply to author
Forward
0 new messages