Including MS Word in a DIV

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?

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

Walter D. 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