Set View Options in Word Documents

The following example shows how you can set a Word document view type and zoom with the GemBox.Document component.

using GemBox.Document;

class Program
{
    static void Main()
    {
        // If using the Professional version, put your serial key below.
        ComponentInfo.SetLicense("FREE-LIMITED-KEY");
        
        var document = new DocumentModel();

        document.Sections.Add(
            new Section(document,
                new Paragraph(document, " ")));

        var viewOptions = document.ViewOptions;
        viewOptions.ViewType = ViewType.Web;
        viewOptions.Zoom = %Zoom%;

        document.Save("View Options.%OutputFileType%");
    }
}
Imports GemBox.Document

Module Program

    Sub Main()

        ' If using the Professional version, put your serial key below.
        ComponentInfo.SetLicense("FREE-LIMITED-KEY")

        Dim document As New DocumentModel()

        document.Sections.Add(
            New Section(document,
                New Paragraph(document, " ")))

        Dim viewOptions = document.ViewOptions
        viewOptions.ViewType = ViewType.Web
        viewOptions.Zoom = %Zoom%

        document.Save("View Options.%OutputFileType%")

    End Sub
End Module
Word document with set view options like zoom
Screenshot of Word file with specified view options

See also


Next steps

GemBox.Document is a .NET component that enables you to read, write, edit, convert, and print document files from your .NET applications using one simple API. How about testing it today?

Download Buy