Anteckning
Åtkomst till den här sidan kräver auktorisering. Du kan prova att logga in eller ändra kataloger.
Åtkomst till den här sidan kräver auktorisering. Du kan prova att ändra kataloger.
Gets or sets the default paragraph style applied to text by the Click and Type feature in the document.
Namespace:  Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word.v4.0.Utilities (in Microsoft.Office.Tools.Word.v4.0.Utilities.dll)
Syntax
'Declaration
Public Property ClickAndTypeParagraphStyle As Object
    Get
    Set
public Object ClickAndTypeParagraphStyle { get; set; }
Property Value
Type: System.Object
The default paragraph style applied to text by the Click and Type feature in the document.
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.
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 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.");
    }
}
.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.