Document.SetDefaultTableStyle, méthode (System 2007)

Mise à jour : novembre 2007

Spécifie le style de table à utiliser pour les tables nouvellement créées dans le document.

Espace de noms :  Microsoft.Office.Tools.Word
Assembly :  Microsoft.Office.Tools.Word.v9.0 (dans Microsoft.Office.Tools.Word.v9.0.dll)

Syntaxe

Public Sub SetDefaultTableStyle ( _
    ByRef Style As Object, _
    SetInTemplate As Boolean _
)

Dim instance As Document
Dim Style As Object
Dim SetInTemplate As Boolean

instance.SetDefaultTableStyle(Style, _
    SetInTemplate)
public void SetDefaultTableStyle(
    ref Object Style,
    bool SetInTemplate
)

Paramètres

  • SetInTemplate
    Type : System.Boolean

    true pour enregistrer le style de table dans le modèle attaché au document.

Exemples

L'exemple de code suivant crée un nouveau style de table et l'ajoute au modèle attaché au document à l'aide de la méthode SetDefaultTableStyle.

Cet exemple illustre une personnalisation au niveau du document.

Private Sub DocumentSetDefaultTableStyle()
    ' Create a new table style.
    Dim newStyle As Word.Style = Me.Styles.Add("TableStyle1", _
        Word.WdStyleType.wdStyleTypeTable)

    ' Set a property of the new style.
    newStyle.Font.Color = Word.WdColor.wdColorBlueGray

    ' Set this style as the default for tables in the document.
    Dim inputStyle As Object = newStyle
    Me.SetDefaultTableStyle(inputStyle, True)
End Sub
private void DocumentSetDefaultTableStyle()
{
    // Create a new table style.
    object tableStyle = Word.WdStyleType.wdStyleTypeTable;
    Word.Style newStyle = this.Styles.Add("TableStyle1", 
        ref tableStyle);

    // Set a property of the new style.
    newStyle.Font.Color = Word.WdColor.wdColorBlueGray;

    // Set this style as the default for tables in the document.
    object inputStyle = newStyle;
    this.SetDefaultTableStyle(ref inputStyle, true);
}

Autorisations

Voir aussi

Référence

Document, classe

Membres Document

Microsoft.Office.Tools.Word, espace de noms