Render with responsive layout

View as MarkdownMarkdown

Set up your AI agent

Give your coding agent live access to the GroupDocs documentation and API reference through the GroupDocs Docs MCP server — no install, no API key. Learn more

claude mcp add --transport http groupdocs-docs https://docs.groupdocs.com/mcp

Also process documents locally

The GroupDocs.Viewer MCP server lets your agent work with files on your machine; they are never uploaded. It needs the .NET 10 SDK or Docker.

claude mcp add groupdocs-viewer -- dnx GroupDocs.Viewer.Mcp --yes
Folders, licensing and more →

Responsive design aims to make web pages render well on a variety of devices. GroupDocs.Viewer provides the RenderResponsive property of the HtmlViewOptions class to render HTML pages with responsive layout.

The following code snippet shows how to render a .docx document to HTML with responsive layout:

using GroupDocs.Viewer;
using GroupDocs.Viewer.Options;
// ...

using (Viewer viewer = new Viewer("sample.docx"))
{
    // Create view options.
    var viewOptions = HtmlViewOptions.ForEmbeddedResources();
    
    // Render the file with responsive layout.
    viewOptions.RenderResponsive = true;
    viewer.View(viewOptions);
}
Imports GroupDocs.Viewer
Imports GroupDocs.Viewer.Options
' ...

Module Program
    Sub Main(args As String())
        Using viewer As Viewer = New Viewer("sample.docx")
            ' Create view options.
            Dim viewOptions = HtmlViewOptions.ForEmbeddedResources()
        
            ' Render the file with responsive layout.
            viewOptions.RenderResponsive = True
            viewer.View(viewOptions)
        End Using
    End Sub
End Module

sample.docx is the sample file used in this example. Click here to download it.

p_1.html (177 KB)
p_2.html (10 KB)
p_3.html (44 KB)
p_4.html (843 KB)
p_5.html (15 KB)

Download full output