WebSettings Class

Web Page Settings. It is the root element of WebSettingsPart.When the object is serialized out as xml, its qualified name is w:webSettings.

Inheritance Hierarchy


Namespace:  DocumentFormat.OpenXml.Wordprocessing
Assembly:  DocumentFormat.OpenXml (in DocumentFormat.OpenXml.dll)


<ChildElementInfoAttribute(GetType(Frameset))> _
<ChildElementInfoAttribute(GetType(Divs))> _
<ChildElementInfoAttribute(GetType(WebPageEncoding))> _
<ChildElementInfoAttribute(GetType(OptimizeForBrowser))> _
<ChildElementInfoAttribute(GetType(RelyOnVML))> _
<ChildElementInfoAttribute(GetType(AllowPNG))> _
<ChildElementInfoAttribute(GetType(DoNotRelyOnCSS))> _
<ChildElementInfoAttribute(GetType(DoNotSaveAsSingleFile))> _
<ChildElementInfoAttribute(GetType(DoNotOrganizeInFolder))> _
<ChildElementInfoAttribute(GetType(DoNotUseLongFileNames))> _
<ChildElementInfoAttribute(GetType(PixelsPerInch))> _
<ChildElementInfoAttribute(GetType(TargetScreenSize))> _
<ChildElementInfoAttribute(GetType(SaveSmartTagAsXml))> _
Public Class WebSettings _
    Inherits OpenXmlPartRootElement
Dim instance As WebSettings
public class WebSettings : OpenXmlPartRootElement


The following table lists the possible child types:

  • Frameset <w:frameset>

  • Divs <w:divs>

  • WebPageEncoding <w:encoding>

  • OptimizeForBrowser <w:optimizeForBrowser>

  • RelyOnVML <w:relyOnVML>

  • AllowPNG <w:allowPNG>

  • DoNotRelyOnCSS <w:doNotRelyOnCSS>

  • DoNotSaveAsSingleFile <w:doNotSaveAsSingleFile>

  • DoNotOrganizeInFolder <w:doNotOrganizeInFolder>

  • DoNotUseLongFileNames <w:doNotUseLongFileNames>

  • PixelsPerInch <w:pixelsPerInch>

  • TargetScreenSize <w:targetScreenSz>

  • SaveSmartTagAsXml <w:saveSmartTagsAsXml>

[ISO/IEC 29500-1 1st Edition] webSettings (Web Page Settings)

This element specifies the set of web page settings that have been specified for a single WordprocessingML document. This element is the root element for the Web Settings part within a WordprocessingML document.

[Example: Consider the following WordprocessingML fragment for the web page settings in a WordprocessingML document:

<w:doNotUseLongFileNames w:val="true" />

The webSettings element contains all of the web page settings for this document. In this case, the web page settings specified for this document are: a frameset defined using the frameset element (§; and a setting specifying that when this file is saved as a web page, all resulting files must not exceed 8.3 characters in length using the doNotUseLongFileNames element (§ end example]

Parent Elements

Root element of WordprocessingML Web Settings part

Child Elements


allowPNG (Allow PNG as Graphic Format)


divs (Information about HTML div Elements)


doNotOrganizeInFolder (Do Not Place Supporting Files in Subdirectory)


doNotRelyOnCSS (Do Not Rely on CSS for Font Face Formatting)


doNotSaveAsSingleFile (Recommend Web Page Format over Single File Web Page Format)


doNotUseLongFileNames (Do Not Use File Names Longer than 8.3 Characters)


encoding (Output Encoding When Saving as Web Page)


frameset (Root Frameset Definition)


optimizeForBrowser (Disable Features Not Supported by Target Web Profile)


pixelsPerInch (Pixels per Inch for Graphics/Images)


relyOnVML (Utilize VML When Saving as Web Page)


saveSmartTagsAsXml (Save Smart Tag Data in XML Property Bag)


targetScreenSz (Target Screen Size for Web Page)


[Note: The W3C XML Schema definition of this element’s content model (CT_WebSettings) is located in §A.1. end note]

© ISO/IEC29500: 2008.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also


WebSettings Members

DocumentFormat.OpenXml.Wordprocessing Namespace