Document.Compatibility Property (2007 System)
Gets a value that indicates whether the specified compatibility option is enabled.
Namespace: Microsoft.Office.Tools.Word
Assembly: Microsoft.Office.Tools.Word.v9.0 (in Microsoft.Office.Tools.Word.v9.0.dll)
Syntax
'Declaration
<BrowsableAttribute(False)> _
Public Overridable ReadOnly Property Compatibility As Document._CompatibilityType
'Usage
Dim instance As Document
Dim value As Document._CompatibilityType
value = instance.Compatibility
[BrowsableAttribute(false)]
public virtual Document._CompatibilityType Compatibility { get; }
[BrowsableAttribute(false)]
public:
virtual property Document._CompatibilityType^ Compatibility {
Document._CompatibilityType^ get ();
}
public function get Compatibility () : Document._CompatibilityType
Property Value
Type: Microsoft.Office.Tools.Word.Document._CompatibilityType
true if the specified compatibility option is enabled; otherwise, false.
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 attempt to use Compatibility without specifying a parameter, Compatibility will get a Document._CompatibilityType object that is part of the Visual Studio Tools for Office infrastructure and 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.
Examples
The following code example suppresses the space before a paragraph if the paragraph is located after a hard page break.
This version is for a document-level customization.
Private Sub DocumentCompatibility()
Me.Compatibility(Word.WdCompatibility.wdSuppressSpBfAfterPgBrk) = True
End Sub
private void DocumentCompatibility()
{
this.Compatibility[Word.WdCompatibility.wdSuppressSpBfAfterPgBrk] = true;
}
This version is for an application-level add-in.
Private Sub DocumentCompatibility()
Dim vstoDoc As Document = Me.Application.ActiveDocument.GetVstoObject()
vstoDoc.Compatibility(Word.WdCompatibility.wdSuppressSpBfAfterPgBrk) = True
End Sub
private void DocumentCompatibility()
{
Document vstoDoc = this.Application.ActiveDocument.GetVstoObject();
vstoDoc.Compatibility[Word.WdCompatibility.wdSuppressSpBfAfterPgBrk] = true;
}
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
See Also
Reference
Microsoft.Office.Tools.Word Namespace
Change History
Date |
History |
Reason |
---|---|---|
July 2008 |
Added a version of the code example for an application-level add-in. |
SP1 feature change. |