What would we need to do to deploy any html document to posit connect and have it viewable

We often have static html documents that we would like to deploy to posit connect, to keep a bunch of stuff in one place, making it easier for colleagues to find them. One example are Word docs. However, we find that although we can deploy such content to posit connect, when they are accessed there, they are not able to be viewed, just downloaded.

How high would the bar be, to get that content to be viewable? Are there relatively simple modifications we could make to the html code, or would it be difficult to do? If it is the latter, is there any intention to open posit connect up to documents beyond rendered R and python output?


Do you mean on an iframe? It’d need to be hosted on Microsoft or Google with a URL to preview it, I think.

Assuming Microsoft products are not an issue, you should be able to view them with MS Edge in the browse, too.

I suspect there’s also a chrome extension, but not certain.

We already have a number of platforms we can push Word docs to, eg Sharepoint. But we would like to deploy them to Posit Connect. Given that Word docx files can be converted to html, I was hoping to be able to deploy that format on Posit Connect, but they are not viewable there. I think you are suggesting another platform to view them on?

Not suggesting another platform, but think more info is needed. You have word docs saved as html files and when you serve the html files, they are downloading instead of rendering? So how are they being served? And they are being saved like example.html?

Particularly, is this set:

'Content-Type': 'text/html'

If you want to deploy static HTML, then
use the command-line interface:

❯ rsconnect deploy html
Usage: rsconnect deploy html [OPTIONS] PATH [EXTRA_FILES]...

  Deploy an html file, or directory of html files with entrypoint, to Posit
  Connect or Posit Cloud.

or rsconnect::deployDoc().

As Joe has been saying, "viewing Word documents in the browser" is a proprietary extension of browser behavior that Microsoft supports for Edge.

Another option you may want to consider is using quarto multi-format publishing to serve the same content as a web page while also making a Word version available.

1 Like

Sorry, I have not been sufficiently clear.

I am starting with a word doc (.docx).
I do not want to convert it to a quarto doc and render it.
I just want to deploy it to Posit Connect.

I have found a solution:
Save the Word doc as a html file from within Word.
This generates the html doc and places images etc in a dir with the extension .fld.
Copy the .html doc and .fld dir to the R project.
In the Posit console, execute rsconnect::deployDoc(.html).
Posit automatically locates the .fld dir and deploys to Posit Connect.

My mistake was not copying the .fld dir to the R project.

I could also have deployed the .docx file itself.
It would have deployed, and although it could not be viewed, it could be downloaded.
Sometimes that might be sufficient.

I went down a few rabbit holes but learnt a lot, so all good.

1 Like