Share via


Document.Compatibility Property

Definition

Gets a value that indicates whether the specified compatibility option is enabled.

public:
 property Microsoft::Office::Tools::Word::Document_CompatibilityType ^ Compatibility { Microsoft::Office::Tools::Word::Document_CompatibilityType ^ get(); };
public Microsoft.Office.Tools.Word.Document_CompatibilityType Compatibility { get; }
member this.Compatibility : Microsoft.Office.Tools.Word.Document_CompatibilityType
Public ReadOnly Property Compatibility As Document_CompatibilityType

Property Value

true if the specified compatibility option is enabled; otherwise, false.

Examples

The following code example suppresses the space before a paragraph if the paragraph is located after a hard page break. This example is for an application-level add-in.

private void DocumentCompatibility()
{
    Document vstoDoc = Globals.Factory.GetVstoObject(this.Application.ActiveDocument);
    vstoDoc.Compatibility[Word.WdCompatibility.wdSuppressSpBfAfterPgBrk] = true;
}
Private Sub DocumentCompatibility()
    Dim vstoDoc As Document = Globals.Factory.GetVstoObject(Me.Application.ActiveDocument)
    vstoDoc.Compatibility(Word.WdCompatibility.wdSuppressSpBfAfterPgBrk) = True
End Sub

Remarks

The Compatibility property is intended to be used with the following parameter.

Parameter Description
Type One of the WdCompatibility values that specifies the compatibility option to check for.

If you use the Compatibility property without specifying a parameter, it returns a Document_CompatibilityType object that is not intended to be used directly from your code.

Compatibility options affect how a document is displayed in Microsoft Office Word. Some of the WdCompatibility values might not be available to you, depending on the language support (U.S. English, for example) that you have selected or installed.

Applies to