DocumentBase.ClickAndTypeParagraphStyle Property

Definition

Gets or sets the default paragraph style applied to text by the Click and Type feature in the document.

public:
 property System::Object ^ ClickAndTypeParagraphStyle { System::Object ^ get(); void set(System::Object ^ value); };
public object ClickAndTypeParagraphStyle { get; set; }
member this.ClickAndTypeParagraphStyle : obj with get, set
Public Property ClickAndTypeParagraphStyle As Object

Property Value

The default paragraph style applied to text by the Click and Type feature in the document.

Examples

The following code example adds text to the first two paragraphs, styles the first paragraph as Plain Text, and then sets the ClickAndTypeParagraphStyle to Plain Text. To use this example, run it from the ThisDocument class in a document-level project.

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.");
    }
}
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 

Remarks

To set this property, specify the local name of the style, an integer, a WdBuiltinStyle constant, or an object that represents the style.

If the InUse property for the specified style is set to false, an exception is thrown.

Applies to