How to renderer a docx file in the asp.net core web?

mc 5,426 Reputation points
2021-06-17T09:15:32.727+00:00

I am using asp.net core web

there is a docx file how to render it in the razor pages?

just render it and no need to edit

Developer technologies ASP.NET ASP.NET Core
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Anonymous
    2021-06-18T06:41:13.537+00:00

    Hi @mc ,

    At present we can't directly render the Word Documents on the web page, and as far as I know, there are no client-side libraries that currently exist for rendering them either.

    As a workaround, you could upload the word file to OneDrive or Google, then, use Microsoft Office viewer or Google Docs Viewer to render the Word document, then get the shared link. After that you can display the word document using an <iframe> tag.

    You could follow the following steps:

    1. Upload the word file to OneDrive.
    2. Choose the word file => click the "View" tab=> and select the "Reading View" option. 106819-capture2.png
    3. Click the "More" icon, and then choose the "Embed" option, 106921-capture3.png
    4. Copy the "Embed" code, and paste it in your web page, the code as below: 106906-capture4.png
    5. The result as below: 106941-capture5.png

    Reference: How do I render a Word document (.doc, .docx) in the browser using JavaScript?


    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Best regards,
    Dillion

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.