HTML Responsive web pages are meant to look good on different devices. These pages automatically adjust according to different screen sizes. This article will guide you to automate the conversion and view your Word documents as responsive HTML pages within your .NET applications using C#.
The following topics will be covered below:
.NET API for Word and Responsive HTML Viewer
I will be using GroupDocs.Viewer for .NET to render the Word documents as responsive HTML pages in the examples below. The API is a powerful document viewer .NET API that supports rendering a large number of documents. It allows building HTML Viewer with embedded and external resources, an Image Viewer by rendering as JPG and PNG, and PDF Viewer that is best for printing or sharing with others.
You can download the DLLs or MSI installer from the downloads section or install the API by adding its package to your .NET application via NuGet.
PM> Install-Package GroupDocs.Viewer
Convert Word Documents to View as Responsive HTML using C#
If you have MS Word DOC, DOCX documents, and want to render these documents into responsive HTML pages to look good on all the different screen sizes, here are the steps and C# code for you.
The following steps show how to convert the Word document (DOC/DOCX) to responsive HTML using .NET API.
- Load the Word document (DOC/DOCX) using Viewer class.
- Set the HtmlViewOptions for either embedded or external resources for the html output.
- Set the RenderResponsive to true.
- Call the View method of Viewer class to generate the responsive webpages of the loaded Word document.
The following just a four-liner source code renders the Word document as responsive HTML with embedded resources using C#.
Get a Free API License
You can get a free temporary license in order to use the API without the evaluation limitations.
Conclusion
To sum up, you have learned how to render the Word documents as responsive HTML pages using C#. Further, you can generate the HTML pages with embedded and external resources. You must be confident to start building your own document viewer .NET application like the one built by GroupDocs.
For more about the API, you can visit documentation and the GitHub repository. In case of further queries and ambiguities, contact the free support on the forum.