How to open a docx file directly in a new page

How to automatically open and display a docx file directly on a new page through a url link?

186308296-afc6cc45-7741-47e6-a34d-e8611a3991f8
(Currently, I can only get the docx file to show up after manually uploading the docx file on the new page…)

Interesting question.

I’m just a noob and someone will probably give a better answer, but - depending on how you’ve deployed this, like if you’re using your own Apache / Nginx / other webserver instead of their SaaS cloud - you could just save the HTML file to a folder being served by your server and then it would be automatically browse-able without needing Streamlit to run. You could just setup a link to it in Streamlit. Right?

So like lets say you’re using NGINX and you’ve got streamlit running app.py in this folder:

/var/www/streamlit/app.py

but NGINX is also serving

/var/www/html

then save the generated file to something like

/var/www/html/mydoc.html

and setup a link in Streamlit that has a variable for the pagename and gets that value from the .docx filename.

Thank you for your reply. I see what you mean. But in fact, I was thinking about how to directly present my docx document content in the streamlit page through a URL link, instead of downloading through the browser access connection as usual.

You can make it into an iFrame this way, within Streamlit. I realize there are many situations I can’t imagine, but in general I’m not sure why you would want it to stay within the Streamlit framework if it’s just pure HTML/CSS - wouldn’t that show the same content but make it slower?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.