Compartir a través de


DocumentBase.ClickAndTypeParagraphStyle (Propiedad)

Obtiene o establece el estilo de párrafo predeterminado aplicado al texto por la característica Hacer clic y escribir del documento.

Espacio de nombres:  Microsoft.Office.Tools.Word
Ensamblado:  Microsoft.Office.Tools.Word.v4.0.Utilities (en Microsoft.Office.Tools.Word.v4.0.Utilities.dll)

Sintaxis

'Declaración
Public Property ClickAndTypeParagraphStyle As Object
public Object ClickAndTypeParagraphStyle { get; set; }

Valor de propiedad

Tipo: System.Object
El estilo de párrafo predeterminado aplicado al texto por la característica Hacer clic y escribir del documento.

Comentarios

Para establecer esta propiedad, especifique el nombre local del estilo, un entero, una constante WdBuiltinStyle o un objeto que represente el estilo.

Si la propiedad InUse del estilo especificado se establece en false, se produce una excepción.

Ejemplos

En el siguiente ejemplo de código se agrega texto a los dos primeros párrafos, se aplica un estilo al primer párrafo como texto sin formato y, a continuación, se establece ClickAndTypeParagraphStyle como Plain Text.Para usar este ejemplo, ejecútelo desde la clase ThisDocument en un proyecto de nivel de documento.

Private Sub DocumentClickAndTypeParagraphStyle()

    Dim styleName As Object = "Plain Text"
    Me.Paragraphs(1).Range.InsertParagraphAfter()
    Me.Paragraphs(1).Range.InsertParagraphAfter()
    Me.Paragraphs(1).Range.Text = "This is sample text."
    Me.Paragraphs(2).Range.Text = "This is sample text."
    Me.Paragraphs(1).Range.Style = styleName

    If Me.Styles.Item(styleName).InUse Then
        Me.ClickAndTypeParagraphStyle = styleName
    Else
        MessageBox.Show(styleName & " is not in use yet.")
    End If

End Sub 
private void DocumentClickAndTypeParagraphStyle()
{

    object styleName = "Plain Text";
    this.Paragraphs[1].Range.InsertParagraphAfter();
    this.Paragraphs[1].Range.InsertParagraphAfter();
    this.Paragraphs[1].Range.Text = "This is sample text.";
    this.Paragraphs[2].Range.Text = "This is sample text.";
    this.Paragraphs[1].Range.set_Style(ref styleName);

    if (this.Styles.get_Item(ref styleName).InUse)
    {
        this.ClickAndTypeParagraphStyle = styleName;
    }
    else
    {
        MessageBox.Show(styleName + " is not in use yet.");
    }
}

Seguridad de .NET Framework

Vea también

Referencia

DocumentBase Clase

Microsoft.Office.Tools.Word (Espacio de nombres)